Guest Login - rezolved/rezolve_sdk_sampleapp_android GitHub Wiki
User can browse the app/use endpoints from Rezolve API without fully signing up and signing in. To achieve that, guest register and login are used. For all the other API calls entityId(sdkEntity) is needed. It can be acquired by registering guest user which will return the sdkEntity in response
Guest User Registration
To register a guest user you can call this endpoint:
POST: https://core.sbx.eu.rezolve.com/api/v2/authentication/register/guest
-H content-type: application/json
-d {
}
Responses:
200 OK
{
"id": 100,
"username": "ab0ed6e0-1022-4c47-83e9-d69af0311540",
"firstName": null,
"lastName": null,
"email": "",
"phone": "",
"language": "en",
"sdkEntity": "ab0ed6e0-1022-4c47-83e9-d69af0311540",
"sdkPartner": "2",
"createdAt": "2022-04-13T12:26:48.418",
"updatedAt": "2022-04-13T12:26:48.418",
"enabled": true,
"partnerId": "2",
"timesLoggedIn": null,
"roles": [
{
"role": "ROLE_USER"
}
],
"guest": true,
"accountNonExpired": true,
"accountNonLocked": true,
"credentialsNonExpired": true,
"timezone": "GMT"
}
Guest User Login
Apart from registering also login is needed to get authorization token which is returned on succesful login. To do so you need to call this endpoint:
POST: https://core.sbx.eu.rezolve.com/api/v2/authentication/login/guest
-H content-type: application/json
-H authorization: Bearer signed-jwt
-d {
"deviceId": deviceId,
"entityId": entityId
}
Responses:
200 OK
{
"id": 100,
"username": "ab0ed6e0-1022-4c47-83e9-d69af0311540",
"firstName": null,
"lastName": null,
"email": "",
"phone": "",
"language": "en",
"sdkEntity": "ab0ed6e0-1022-4c47-83e9-d69af0311540",
"sdkPartner": "2",
"createdAt": "2022-04-13T12:26:48.418",
"updatedAt": "2022-04-13T12:26:48.418",
"enabled": true,
"partnerId": "2",
"timesLoggedIn": 1,
"roles": [
{
"role": "ROLE_USER"
}
],
"guest": true,
"accountNonExpired": true,
"credentialsNonExpired": true,
"accountNonLocked": true,
"timezone": "GMT"
}
Authorization token is returned in response header - "Authorization"
Upgrade to standard user
When user wants to register as normal user you should upgrade the guest user to normal by calling this endpoint with the entityId returned by guest register:
PUT: https://core.sbx.eu.rezolve.com/api/v2/authentication/register/guest
-H content-type: application/json
-H authorization: Bearer signed-jwt
-d {
"phone": phone,
"entityId": entityId,
"email": email
}
Responses:
201 OK
{
"partner_id": "4",
"entity_id": "d89d-d34fd-fddf45g8xc7-x8c7fddg"
}