How to register an invited user to an app through the Cosync REST API #
Register an invited user account. This function will register a user with the CoSync Auth service with a six digit verification code that was sent to the user email. This call will return a JWT token for the signed up user, and an access token for REST calls.
This function will fail if the metaData requirements are not met and return a 604. Note, the registering user’s meta data is combined with the metadata set by the inviting user.
This function can be passed an option locale
parameter, which specifies the user’s locale.
URL #
/api/appuser/register
Method #
POST
Headers #
app-token: "<App Token>"
Data Parameter #
{
handle: "<user handle>",
password: "<user password>",
code: "<verification code>"
metaData: "<JSON string of user meta data>"
locale: <"locale for user">
}
Response: #
Success: #
StatusCode: #
200 (OK)
Contents: #
{
"jwt": "<JWT for logged in user>",
"access-token": "<access token for user>"
}
Error: #
StatusCode: #
400 (BAD REQUEST)
500 (INTERNAL SERVER ERROR)
Content: #
{
code: "<internal error code>",
message: "<readable error description>"
}
The internal codes are integers:
- 400 - invalid app token
- 401 - app no longer exists
- 402 - app is suspended
- 403 - missing parameter
- 404 - user account is suspended
- 406 - app does not support invite
- 413 - app is migrated
- 500 - internal server error
- 601 - user already registered
- 602 - invalid data
- 604 - invalid metadata
- 609 - invalid locale
- 611 - apple account already exist
- 612 - google account already exist