Get User Login Status
Enterprises usually have multiple website systems. For user experience, after the user logs in to the first website application, when visiting the home page of the 2nd/nth website application in the same browser, it is desired to call the IDaaS API via Ajax in advance to know the current user's login status. If the user is already logged in, they directly log in to the 2nd/nth website without manually clicking the login button to trigger the SSO flow.
Request Description
GET https://{domain_name}/api/v1/config/isLogin
Request Headers
| Parameter Name | Chinese Name | Required | Type | Description |
|---|---|---|---|---|
| Cookie | SSO Cookie | Yes | String | For example: AMS_SID=abcde-123,The browser automatically carriesCookiesend |
Request Example
采用Ajax请求代码示例:
$.ajax({
url: "https://{your_domain}/api/v1/config/isLogin",
type: "get",
dataType: 'json',
xhrFields: {
withCredentials: true // Ajax请求携带跨域cookie
},
success(data) {
console.info(data);
},
error(err) {
console.log(err);
}
});Request Parameters
None
Response Example
User logged-in response example
HTTP/1.1 200 OK
trueUser not-logged-in response example
HTTP/1.1 200 OK
falseResponse Parameters
true:Indicates the user is logged in
false:Indicates the user is not logged in
Notes
Because the get user login status API is a front-end API, front-end calls involve cross-origin (cross origin)and cross-site (cross site)situations.
In cross-origin/cross-domain scenarios, the allowed cross-domain domain whitelist must be configured in the Enterprise Center;
In cross-site scenarios, currentlySafaribrowser enables“Prevent cross-site tracking”,prohibiting cross-site access to third-partyCookie。The solution is to customize theIDaaSdomain to the enterprise's own domain, turning cross-site into same-site.