Authenticating using Self Sign Up
Before You Begin
If you want to follow along, you need the following:
- A Commerce account and the Client ID and Client Secret of your store, available from your Commerce Manager.
- A front-end application or a custom application accessible to you in a web browser which accesses the Commerce API with the implicit token.
- A basic understanding of object-oriented programming or JavaScript.
- An access token.
Step-by-step Walkthrough
The following list outlines the steps of the single sign-on authentication flow to get account token:
- Create Password Profile.
- Update the Account Authentication Settings.
- Generate a token using self_signup mechanism.
- Login as an admin and add account member created to the account.
Create password profile
Send a POST request to create a password profile to use for self sign up. Make sure you set the username_format
to email
.
Use the id
from the returned response to authenticate using self sign up.
You can find more detailed instructions on password profile creation here
Update the account authentication settings
Send a PUT request to update Account Authentication Settings to set enable_self_signup
to true
. This enables self sign up for the account.
You can also set auto_create_account_for_account_members
to true
. This automatically creates an account for the account member and then creates a membership.
Generate a token using self sign up
Send a POST request to generate a token using the self sign up authentication mechanism. This creates an account member that you can add to the account. You can find more detailed instructions on generating an authentication token using self sign up here.
Login as an admin and add account member created to the account
Log in as an Admin to add a newly created account member to the account. Once this step is completed, a buyer can log in as usual.
If your auto_create_account_for_account_members
setting in account authentication settings is set to false
then you need to manually create an account for the account member and afterwards create account membership.
If the setting is set to true
, you can log in as usual without any additional steps.