Redirect Hosted Login links

Redirecting the "Visit our help center" Link


By default, three different links are defined for you when you first get Hosted Login up and running:

Link NameUsed on …Link Text
linkHelp… all Hosted Login screensVisit our help center
linkPrivacyPolicy… registration and re-acceptance screensprivacy policy
linktermsOfService… registration and re-acceptance screensterms of service

You can return information about these links by using the GET method and the /config/{app}/flows/{flow}/links operation. For example:

curl -X GET \
  'https://v1.api.us.janrain.com/config/79y4mqf2rt3bxs378kw5479xdu/flows/testFlow/links' \
  -H 'Authorization: Basic eTR4Zmc2ZjQ0bXNhYzN2ZXBqanZ4Z2d6dnQzZTNzazk6OTVjY3hrN2N6YnZ1eng2ZHB0ZTVrOXA2ZGo1Ynpla3U='

If this call succeeds, you’ll get back a response similar to this:

[
    {
        "_self": "/config/79y4mqf2rt3bxs378kw5479xdu/flows/testFlow/links/linkHelp",
        "name": "linkHelp"
    },
    {
        "_self": "/config/79y4mqf2rt3bxs378kw5479xdu/flows/testFlow/links/linkPrivacyPolicy",
        "name": "linkPrivacyPolicy"
    },
    {
        "_self": "/config/79y4mqf2rt3bxs378kw5479xdu/flows/testFlow/links/linkTermsOfService",
        "name": "linkTermsOfService"
    }
]

To get detailed information about a specific link, just append the link name (e.g., linkHelp) to the end of your previous API call:

curl -X GET \
  'https://v1.api.us.janrain.com/config/79y4mqf2rt3bxs378kw5479xdu/flows/testFlow/links/linkHelp' \
  -H 'Authorization: Basic eTR4Zmc2ZjQ0bXNhYzN2ZXBqanZ4Z2d6dnQzZTNzazk6OTVjY3hrN2N6YnZ1eng2ZHB0ZTVrOXA2ZGo1Ynpla3U='

That returns information similar to this:

{
    "elementHref": "#",
    "elementText": {
        "key": "12ed346de096c8dd8f5407ad1aa4aaa6",
        "path": "fields.linkHelp.elementText",
        "values": {
            "en-US": "Visit our help center."
        },
        "_self": "/config/79y4mqf2rt3bxs378kw5479xdu/flows/testFlow/translations/12ed346de096c8dd8f5407ad1aa4aaa6"
    },
    "name": "linkHelp",
    "_self": "/config/79y4mqf2rt3bxs378kw5479xdu/flows/testFlow/links/linkHelp"
}

Take a close look at the value of the elementHref property. By default, anytime you click the Visit our help center link on the sign-in screen another copy of the sign-in screen opens up on top of the current sign-in screen (or in a separate tab, depending on how your browser is configured):

img

Why does this happen? Two reasons. First, the elementHref property (which specifies the URL of the page you’re taken to after clicking Visit our help center) is initially set to #. In HTML, that means, “Take me to the top of the current page.” In addition to that, the target property (which isn't returned in your API call) is set to _blank; that tells the browser that the linked-to page should be opened in a separate window or a separate tab. Put the two together, and you end up opening a second copy of the current page in another window or tab, and then navigating to the top of that page. At any rate, you don’t go to your help center page.

In turn, that means that, if you want to point the Visit our help center link to the URL of your actual help center. you need to change the target of the linkHelp link. To do that, use the /config/{app}/flows{flow}/links/{link} operation and the PUT method to create an API call similar to this:

curl -X PUT \
  'https://v1.api.us.janrain.com/config/79y4mqf2rt3bxs378kw5479xdu/flows/testFlow/links/linkHelp' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Basic eTR4Zmc2ZjQ0bXNhYzN2ZXBqanZ4Z2d6dnQzZTNzazk6OTVjY3hrN2N6YnZ1eng2ZHB0ZTVrOXA2ZGo1Ynpla3U=' \
  -d '{
    "elementHref": "https://identitydocs.akamai.com",
    "elementText": {
        "key": "12ed346de096c8dd8f5407ad1aa4aaa6",
        "path": "fields.linkHelp.elementText",
        "values": {
            "en-US": "Visit our help center."
        }
    },
    "name": "linkHelp",
    "target": "_blank"
}'

As you can see, in this call we change the value of the elementHref property: instead of pointing the Visit our help center link back to the current screen (#), we point that link to the URL https://identitydocs.akamai.com.

If you run the preceding API call, and if that call succeeds, you’ll get back a 204 No content HTTP status code. More importantly, however, look what happens when you click the Visit our site link:

img

As you can see, the link now opens your actual help center in a separate window or tab, just the way you would expect it to.

If you’d like the privacy policy and terms of service links to point to actual web pages as well, simply repeat this process with the linkPrivacy and linkTermsOfService links.