Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
101 lines (71 sloc) 3.41 KB

SSO login link

Providing a login link directly in your application is a user-friendly way to implement single sign-on for Chargely. The images below illustrate the user experience of this mechanism.

  1. Your customer logs in to your existing web site.

    Log in form
  2. Your customer clicks the Chargely SSO login link. The login link can be placed anywhere you want inside your application.

    Your app dashboard
  3. Your customer is logged in to their Chargely customer dashboard. No additional passwords required.

    Chargely customer dashboard

Create a refresh token endpoint

The first step to creating a login link is to create a refresh token endpoint on your server; e.g.

This endpoint will be responsible for generating the SSO login URL needed for your customers to access Chargely. The following documents will help you with generating a refresh token.

Add JavaScript snippet to your page

The JavaScript snippet is responsible for the following:

  1. Requesting a refresh token from your server via AJAX.
  2. Turning any element on your page into a clickable login link. (usually an <a> tag but it can be anything)
  3. Refreshing the token so it doesn't expire. SSO tokens expire every 5 minutes so the snippet refreshes every 4:50.

Code sample

Success! If all goes well your customers can now log into Chargely with the click of a button. Please contact us for assistance if you have any trouble.