DEVELOPER CENTER
Step-by-Step

Implement Single Sign On

13min

Follow the links below for provider setup based on your single sign on requirement.

Use Case

I already have a web app and login functionality and would like to add an ability for my users to login using their existing identities in application like Google, Facebook etc.

Once implemented I would like to map the my internal userId to the user's publicly shared emailId.

The external identity provider will give me the publicly shared emailId.

Assumptions

The document assumes that the login flow involves 3 pages. They have been separated for ease of understanding the implementation process. Feel free to club the logic based on your implementation.

  • Login (referred to as: LOGIN_PAGE_URL)
  • Session Validator (referred to as: SESSION_VALIDATOR_PAGE_URL)
  • Home (referred to as: LOGIN_PAGE_URL)

Login Page

Add the $pinc_onload with render



JS


Add the Pathfix helper script

The modules loaded here are pinc.auth.min and ui.auth. To learn more about module dependencies go Module dependencies .

data-user-id

This property is not used by the pinc.auth module. The module assumes an anonymous user at this stage.



HTML


Add the login container to your <body>

Add a div with a class name or id and where you want the login buttons to be rendered.

HTML


All together

HTML




Session Validator Page

Add the $pinc_onload without render

The session validator page is used as an intermediate page to either send the user to the home page or back to login. This page is usually merged with the home page to avoid too many redirects. We have included it in this document for clarity in understanding.

JS


Add the script tag

HTML
JS


All together

HTML




Home Page

The home page is the landing page for your user once they are logged in successfully.

Add the $pinc_onload without render

JS


Add the script tag

HTML
JS