Account Mapping

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 auth_info.

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 BrianMan692 user.

User Mappings on RPX Server

Figure 1: User Mappings on RPX Server

Account Mapping in the Login Workflow

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:

User-managed Account Mapping

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:

  1. Extract the provider profile data from auth_info.
  2. Call the /map API, passing the user’s primary key (see Figure 1) and the new social identifier.
  3. Redisplay the user back to the account management page with the list of mapped providers.