Customizing the Flow of the User Experience

How do I add or remove a new form?

Adding and removing forms is not currently supported via API. Please reach out to your Janrain contact via the Customer Support Portal to discuss this requirement.

You can always view the list of forms on your application by making a GET call to the /config/{app}/flows/{flow}/forms/{form} endpoint.

How do I personalize the user’s experience after login?

Some pieces of information, such as uuid, email and displayName, can be made available locally without the need for making API calls. This information can be used to personalize an user’s experience, such as by displaying their username upon logon.

One way to get this information is to add a function handler to the onCaptureLoginSuccess event, and then to access it via the userData object:

  janrain.events.onCaptureLoginSuccess.addHandler(function(result){
      vardisplayName = result.userData.displayName;
      // Use displayName in some way...
  });

Another method is to persist this information via local storage, and then to extract it later (such as for a welcome message upon an user’s return to your site). To do this, both the setProfileCookie and returnExperienceUserData settings need to be enabled.

janrian.settings.capture.setProfileCookie = true;
janrian.settings.capture.returnExperienceUserData = ["displayName","email"];

These will make available uuid, email, and displayName in a JSON object, inside the janrainCaptureProfileData local storage key. To access this information, you can then utilize the getprofilecookiedata JavaScript function:

vardisplayName = janrain.capture.ui.getProfileCookieData('displayName');

This also makes the data available in janrainCaptureReturnExperienceData, which can be accessed via the getReturnExperienceData function:

janrain.capture.ui.getReturnExperienceData('displayName');

Extending the Local Profile Information

Should you wish to make available more information than uuid, email, and displayName, then you will need to make a Flow change. To do this, make a PUT request on the userData object via the /config/{app}/Flows/{Flow} endpoint with the additional information you want made available:

{
  "userData": [
    "email",
    "displayName",
    "familyName",
    "primaryAddress.country"
  ],
  "schemas": [
    "myCoolEntityType"
  ]
}

Finally, remember to update your returnExperienceUserData setting with the appropriate attributes:

janrian.settings.capture.returnExperienceUserData = ["displayName","email","familyName","primaryAddress.country"];

How do I pre-populate a form with data returned from an identity provider?

After an user authenticates socially from the signIn form, you may want to pre-populate the socialRegistration form with additional information returned from the social profile. This can be enabled for a field by adding the socialProfileData key to it.

To do this, add or update a field to include the socialProfileData key, like in the example below. Note that this key can only be added to “text”, “email”, and “textarea” type fields.

{
  "type": "text",
   "name": "myCustomTextField",
   "schemaAttribute": "displayName",
   "label": "My Custom Text Field",
   "socialProfileData": "profile.displayName" 
}