Authenticated vs unauthenticated users

Matthew Endresz

Last Update 5 months ago

Authenticated user flow:

  • To populate the XRii UI, you would generate the token for the user by calling the following API:
URL: https://stage-app-server.xrii.io/customUserSignUpMethod Type: POST
Payload: {“mId”:”7u4v6sn8ia”, “FirstName”:”value”,”LastName”:”value”, “email”:”value”}
Content-Type: application/json
Success Response: {
“data”:”token”, err: null
}
Error Response: {
“data”:null, “err”:”message”
}
Populate UI passing the users token: https://stage-app.xrii.io/?token=GENERATED_TOKEN


Unauthenticated user flow:

  • To populate the XRii UI, you would generate the token for a dummy account. All users can use the token generated by passing the same credentials, as they won't be able to collect a reward using it. It's only for showing rewards. When they enter a collection stage, we will hand it over to you to reveal the login/signup form. Communication for it is mentioned below.
URL: https://stage-app-server.xrii.io/customUserSignUpMethod Type: POST
Payload: {“mId”:”7u4v6sn8ia”, “FirstName”:”Dummy”,”LastName”:”User”, “email”:”dummy_user@xrii.io”}
Content-Type: application/json
Success Response: {
“data”:”token”, err: null
}
Error Response: {
“data”:null, “err”:”message”
}


Other notes:

  • Populate UI passing the user token: 
https://stage-app.xrii.io/?token=GENERATED_TOKEN
  • When a user performs a step where we determine they need to be authenticated to proceed further, we can inform you by calling a function you inject into our PWA.
window.xrii.postMessage("redirect_user")
  • Once logged in, you repeat the steps in the Authenticated user flow and show the user the relevant page by updating the token in the URL.


Note:

  • You should store the user's current URL before redirecting him to log in so that you can replace the token, and the user will return to the same page he left. 

Was this article helpful?

0 out of 0 liked this article