Login Anonymous

How to login anonymously using the Cosync REST API #

Login to the app as an anonymous user. This function is passed a handle of the anonymous user. The format of the anonymous user handle is:

	ANON_<UUID>

Where UUID is a globally unique identifier created by the client. The server will create an anonymous user if the handle conforms to this format. For anonymous users the password field is ignored and is the empty string. Anonymous users do support metadata. Anonymous users are also no verified.

If the handle does not exist, the server will create a user for it. If the handle format does not conform to ANON_<UUID>, the function will fail, and return a 600 error code.

This function is only supported if the app supports anonymous login, i.e. if anonymousLoginEnable, and return a 414 error code.

URL #
    /api/appuser/loginAnonymous
Method #
    POST
Headers #
	app-token: "<App Token>"
Data Parameter #
    {
        handle: "<user handle>"
    }

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
  • 413 - app is migrated
  • 500 - internal server error
  • 600 - invalid login credentials