Help > Forum > Website Integration > Programmatically creating a user's account
Programmatically creating a user's account
You can use the API to programmatically create a user's account.
Alternatively, if you're using token-based single sign on, the account can automatically be created when you make a request to get a log in token. When using this approach, you must first check your local database to ensure that the user's username and email address are both not already taken in the forum since the single sign on process will not create a user and will just return a log in token if a user already exists with a matching email address or username.
If you're unable to check your local database before making a token-based single sign on request during your signup process, you can use the process below to create a user and receive a log in token. Since the process below is only for sign up and not for log in, it will return a user-friendly error message if a user already exists with the specified username or email address. The benefit of using this approach instead of using the API to create the user is speed. You can create the user, receive the log in token, and also receive the user object all in one request.
Make an HTTP request to the following URL:Replace USERNAME.websitetoolbox.com with your forum address and APIKEY with your forum API Key.
Then extend the URL with the additional parameters for SSO account creation.
The response from the server will be in JSON format similar to this:
{ "userid": "The numerical userid of the newly registered user will be here.", "authtoken": "A random string representing a log in token.", "user": A User object }
If an error occurs during the regitration, the JSON response will look like this:
{ "message": "The error message will be here." }
If you still need help, please contact us.