Signup

How to signup a user through the Cosync REST API

his function may cause the CosyncJWT service to verify the handle if it is an email or phone number. This verification is done by either sending a six digit verification code to the handle associated with the user account if the signup flow is code, otherwise it sends a link to the handle that the user can click if the signup flow is link. Password should be in MD5 format.

  • If the signup flow is none, the user is automatically signed up to the application without verification.
  • If the signup flow is handle, the user handle is sent a six digit code that must be passed to the completeSignup REST API function.
  • If the signup flow is link, the user handle is sent a web link that the user can click to confirm identity.

The password that is passed in should be in MD5 format.

This function will fail if the metaData requirements are not met and return a 604.

The metaData is structured JSON data that is passed to the CosyncJWT service at the time of signup. If the signup is successful and a new user is created, the metaData is saved in the metaData of the user. This mechanism allows a new user to pass information like signup coupon codes.

If the signup flow is none, this function will return the jwt and access-token for the newly signed up user.

URL
    /api/appuser/signup
Method
    POST
Headers
    app-token: "<App Token>"
Data Parameter
   {
        handle: "<user handle>",
        password: "<user password>",
        metaData: "<JSON string of user meta data>" 
    }

Response:

Success:
StatusCode:
    200 (OK)
Contents:
    true
    or 
    {
        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
  • 407 - app does not support signup
  • 500 - internal server error
  • 601 - handle already registered
  • 602 - secondary already registered
  • 604 - invalid metadata