Modify the user experience flow

📘

Much of the content on this page deals with a legacy feature of the ​Akamai​ Identity Cloud (in this case, the JavaScript SDK). If you are currently an Identity Cloud customer and are using the JavaScript SDK, that SDK is still supported. However, if you’re new to the Identity Cloud the JavaScript SDK is no longer available. Instead, you should use Hosted Login for your login and registration needs.


Create or delete forms

You can use either Console or the Identity Cloud Configuration APIs to create and delete forms. To create a form by using Console, see the article Create a form; for information on deleting forms by using Console, see Delete a form.

If you prefer working with the APIs, forms can be created by using the /config/{appId}/flows/{flow}/forms operation and the POST method. Similarly, forms can be deleted by using the /config/{appId}/flows/{flow}/forms/{form} operation and the DELETE method.


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 a 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){
      var displayName = 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 a user’s return to your site). To do this, both the setProfileCookie and returnExperienceUserData Registration JavaScript API 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:

var displayName = 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');

Extend 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} operation 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"];

Pre-populate a form with data returned from an identity provider

After a 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"
}