Single Sign-On
Configuration - Set the network
/login
page - add login button and send to Pangea Passport/callback
page - receive callback/
home page - check for logged in users
Examples below are for a Reactjs website.
1. Configuration - Set the network
Configure to use a specific network (in this case, the Pangea demo network). Run this at the javascript root of your app (e.g. App.tsx in Reactjs) so they are set before used
If you are getting an error about the fetch object like TypeError: Failed to execute 'fetch' on 'Window'
you might also need to override the fetch object used by the SDK:
2. Login page
On your login page set it to call the ExternalUser.loginWithPangea
function when pressed. Set your /callback
page path as shown below. This is where your the user will be redirect to in your application, after they complete the login process.
Request data sharing
During the login process, you can additionally request information from the user account by adding a dataRequest
object when calling the loginWithPangea
function.
Currently, only the username
is able to be requested. We are working on supporting more data sharing options soon including basic personal information (name, date of birth, etc...) and sharing of data between applications.
3. Callback page
In your /callback
page, call the ExternalUser.verifyLoginRequest()
function when the page renders. This will catch the login parameters from the URL and return a logged in user object.
4. Home page
On your home page or when your app first loads (App.tsx in reactjs), check if the user is already logged in.
Last updated