Janrain Social Login enables your site to associate a conventional user account with all of a user’s social identities. We call these associations account mappings.
The mapping API will store a primary key for a user from your database with each of the user’s external social identifiers on the Janrain server. In order to use the mapping API, a user record must exist in your database, and the user must have verified his/her identity with Social Login so that you have both the primary key and the social identifier. All of a user’s account mappings, including the primary key, will be returned on every subsequent call to
Figure 1 represents a website using Social Login with a Users table that has a primary key called
id. A user has bound three different provider identities to the user’s account, and because the website is using the mapping API, the user may use any one of the user’s mapped accounts to sign in as the
When a user authenticates through Social Login, your site can evaluate the
auth_info response to determine the appropriate next step in the login workflow:
/mapAPI call to associate the user’s primary key with the social identifier used for authentication and log the user in to your site.
Your site may allow users to map additional providers to their account from an account management page. This page should display a list of users’ mapped providers, each with an option to remove the mapping, along with links to add additional providers for authentication.
The easiest way to handle the additional provider buttons and redirect the user back to the account management page is to create an alternate token URL page and pass that path to the Social Login
token_url parameter with the
auth_info call. This alternate token URL should:
mapAPI, passing the user’s primary key (see Figure 1) and the new social identifier.