Single Sign On

Single Sign On Integration Guide

Last updated:Jul 02, 2024

Imagine a world where one set of credentials gives you access to multiple applications. That’s the convenience Single Sign-On (SSO) brings. It simplifies user experience, reduces password fatigue, and enhances security.

What makes OAuth OpenID Connect special?
OAuth OpenID Connect is the engine that powers SSO. It’s an authentication standard built on OAuth 2.0. Unlike SAML, which uses XML, OAuth OpenID Connect uses JSON. This makes it lightweight and perfect for the web. It verifies user identity and gathers basic profile information in a secure and efficient manner.

Why are SSO and OAuth OpenID Connect the perfect pair?
When you log into one application using SSO with OAuth OpenID Connect, you’re authenticated across all connected applications. It’s seamless, efficient, and the future of authentication.

Use cases

User login

Authenticate swiftly and securely with your trusted identity provider. Experience a seamless login process, bypassing the need to remember another set of credentials. Enjoy the enhanced security provided by your identity provider’s robust authentication measures. This is the convenience and security of Single Sign-On.


How it works

Initiate authorization

Redirect the user to the identity provider's page.

Acquire access token

Request an access token post successful authorization.

Retrieve user information

Use the access token to fetch user information and decide to grant the user access.

User-Browser Interaction

Application-Server Interaction

Application-Server Interaction


1. Initiate authorization

This step occurs in the user’s browser.

  • Initiate Authorization: Your application redirects the user’s browser to the identity provider’s authorization endpoint (/v2/authorize).
  • User Login: The user enters their credentials and logs in on the identity provider’s page.
  • Return to Application: Post successful login, the user’s browser is redirected back to your application. This redirect URL is predefined during the initial authorization call.

Show request parameters

Sample request:

2. Acquire access token

This step is handled by your application’s server.

  • Acquire Access Token: Your application makes a request to the identity provider’s token endpoint (/v2/token) and receives an access token.

Show request parameters

Show response parameters

Sample request:

3. Retrieve user information

This step is also handled by your application’s server.

  • Retrieve User Information: Your application uses the access token to query the identity provider’s user information endpoint (/v2/userinfo).
  • User Login Confirmation: Based on the received information and your application’s rules, decide whether to grant the user access.

Show request parameters

Show response parameters

Sample request:

Session Tracker

Experience the power of real-time session tracking in Single Sign-On (SSO). Our session tracker keeps you informed about the user’s active status in the Authentication Manager and any logout actions from connected applications. Upon logout, your application receives an instant alert, enabling swift response. Post-action, your application is ready to initiate a new Login Workflow, ensuring a smooth transition for potential user re-login. Discover enhanced control and fluid user management with our session tracker in SSO.

Here’s the swift workflow:
  • User logs into your application via the Login Workflow.
  • User navigates to a different application, like the Open Payment Platform.
  • User logs out, activating the Logout workflow on the visited application.
  • User accesses an internal page in your application. The Session Tracker JavaScript Snippet promptly alerts your application about the session change.
  • Your application swiftly terminates the local user session and readies a new Login Workflow.

How it works

Responding to logout events

Listen to logout events.

Verifying user login status (individual check)

Perform individual checks to see if the user has remotely logged out.

Verifying User Login Status (polling)

Continually verifies at set intervals if the user has logged out.


1. Responding to logout events

Your application can receive notifications about changes in the user’s remote session (on the Authentication Manager) by embedding a JavaScript Snippet on each page of your application. This allows your application to take action, such as terminating the local user session and initiating a new Login Workflow.
Please add the following JavaScript code to each page of your application that needs to respond to remote logout events:

Sample:

<script type="text/javascript">
(function(w, d, o, u, r, a, m)  {
	w[r] = w[r] ||
		function() {
			(w[r].q = w[r].q || []).push(arguments);
	};
	a = d.createElement(o),
	m = d.getElementsByTagName(o)[0];
	a.async = 1;
	a.src = u;
	m.parentNode.insertBefore(a, m);
})(window, document, 'script', 'https://eu-test.oppwa.com/sso/sessionTracker/oasm.js', '_OASM');
 
//put your client id instead of {your_client_id}
_OASM('client_id', '{your_client_id}');
 
//callback for whenever the session status is different than expected
_OASM('on_change', function(){
	//remove user session locally
	//start a new Login Workflow
});
</script>
		

2. Verifying user login status (individual check)

After integrating the above script into your page, your application can perform individual checks to see if the user has remotely logged out. If the remote login status of the user is not as expected (‘logged_in’), your application will be notified via the function defined by _OASM('on_change').

Sample:

_OASM('check', 'logged_in');

3. Verifying User Login Status (polling)

Your application can also set up a polling mechanism that continually verifies at set intervals if the user has logged out.

Sample:

// Set the interval (in milliseconds) at which your application should verify if the user has logged out.
_OASM('poll', {state:'logged_in', interval: 10000});
		

User logout

Authenticate swiftly and securely with your trusted identity provider. Experience a seamless login process, bypassing the need to remember another set of credentials. Enjoy the enhanced security provided by your identity provider’s robust authentication measures. This is the convenience and security of Single Sign-On.


How it works

Terminate session

Redirect the user to the identity provider's page.


1. Terminate session

Redirect the user to the identity provider’s page to initiate the authorization process.

Sample request: