Single Sign-On
Single Sign-on (SSO) occurs when a user logs in to one application and is then signed in to other applications automatically, regardless of the platform, technology, or domain the user is using. The user signs in only one time, hence the name of the feature (Single Sign-on).
For example, if you log in to a Google service such as Gmail, you are automatically authenticated to YouTube, Google Drive, Google Analytics, and other Google apps. Likewise, if you log out of your Gmail or other Google apps, you are automatically logged out of all the apps; this is known as Single Logout.
How it works with Epixel MLM Software
For the implementation of SSO service, the services connected to our system are considered as two types of services. ie; host and client services.
The service in which the user logs directly is called host service and the services which are logged from this host service is called the client service.
Workflow:-
Login
user logs in to a service by using login credentials (host).
an API session-id is created in the host service.
when the user requests another service, a request is sent to the particular login endpoint of the requested service with a single time token.
then using the received single time token and an apikey a request is sent to the host service to validate the request. after validating the request an API session-id and an access token are returned.
in the client service using the access token user is authenticated. and an acknowledgment is sent to the host service. Logout
Logout
if a user requests log out from any of the services it will automatically log out the user from all services.
Log out from the host service
a request with API session-id is sent to the logout end point of all the services which are logged in using the host service.
then the client service will destroy the session related to the API session-id.
Log out from the client service
The API session id is passed to the host service.
then the host service will destroy all the sessions related to the API session-id.
Single Sign-On Service Request
PUT
‎https://<domain>/<sso prefix>/<version>/service-request/
This endpoint will return a unique login URL of the requested service. Normally this is an in-site ajax request.
Request Body
Name | Type | Description |
---|---|---|
service* | string | service slug |
Error Responses
Status Code | Error Type | Field | Description |
400 | Validation Error | service | This field is required. |
400 | Validation Error | service | This field may not be blank. |
403 | Permission Denied | Please login first to continue. | |
500 | Server Error | Service request failed. | |
500 | Server Error | No Service user found. Please contact admin. | |
500 | Server Error | Service not registered. Please contact admin. |
Single Sign-On External Service Request
POST
‎‎‎‎‎‎‎‎https://<domain>/<api prefix>/<version>/sso/service-request/
Requesting unique login url for another service from host service This API endpoint will return unique login url for the requested service
Headers
Name | Type | Description |
---|---|---|
apikey* | string | apikey |
Request Body
Name | Type | Description |
---|---|---|
service* | string | service slug |
api_sid* | string | api session id |
Sample code
Node
PHP
Error Responses
Status Code | Error Type | Field | Description |
400 | Validation Error | service | This field is required. |
400 | Validation Error | api_sid | This field is required. |
400 | Validation Error | service | This field may not be blank. |
400 | Validation Error | api_sid | This field may not be blank. |
404 | No Session Found | No Logged-in session found with this api_sid. | |
500 | No Service Found | Service not registered. Please contact admin. |
Single Sign-On URL Token Verify
POST
‎‎https://<domain>/<api prefix>/<version>/sso/token-verify/
This endpoint will return an API session-id and an access token.
Headers
Name | Type | Description |
---|---|---|
apikey* | string | apikey |
Request Body
Name | Type | Description |
---|---|---|
token* | string | url token |
Sample code
Node
PHP
Error Responses
Status Code | Error Type | Field | Description |
400 | Validation Error | token | This field is required |
400 | Validation Error | token | This field may not be blank. |
400 | Validation Error | token | Invalid token. |
500 | Server Error | Token generation failed |
Single Sign-On Login Acknowledgment
POST
‎‎‎‎‎‎‎‎‎https://<domain>/<api prefix>/<version>/sso/login-acknowledgement/
This endpoint will acknowledge the host service.
Path Parameters
Name | Type | Description |
---|---|---|
* | string | apikey |
Request Body
Name | Type | Description |
---|---|---|
api_sid* | string | api session id |
service* | string | service slug |
Sample code
Node
PHP
Error Responses
Status Code | Error Type | Field | Description |
400 | Validation Error | service | This field is required |
400 | Validation Error | service | This field may not be blank. |
400 | Validation Error | api_sid | This field is required |
400 | Validation Error | api_sid | This field may not be blank. |
401 | Request Failed | Invalid service with api_id. |
Single Sign-On User Logout
POST
‎‎https://<domain>/<api prefix>/<version>/sso/logout/
This API endpoint will destroy all sessions based on the api_sid.
Headers
Name | Type | Description |
---|---|---|
apikey* | string | apikey |
Request Body
Name | Type | Description |
---|---|---|
api_sid* | string | api session id |
Sample code
Node
PHP
Error Responses
Status Code | Error Type | Field | Description |
400 | Validation Error | api_sid | This field is required |
400 | Validation Error | api_sid | This field may not be blank. |
400 | Validation Error | api_sid | Invalid api_sid. |
Last updated