Updated on 2024-12-30 GMT+08:00

Refreshing session_token

Function

This API is used to refresh session_token.

URI

POST /api/v2/tenant/sso/session-token/refresh

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Set this field to "application/json;charset=utf8".

Authorization

Yes

String

Authentication credential. The value is Bearer {access_token}. access_token is obtained by calling the API for obtaining an access credential.

X-tenant-id

No

String

External ID of a tenant. This parameter is mandatory if the API is called by an ISV. Replace "{domain_name}" with the ISV common domain name "{common_domain}". The tenant ID of the corresponding tenant must be specified in the request header.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

session_token

Yes

String

session_token after user login.

operating_sys_version

Yes

String

Caller OS version, for example, Android 10.

device_ip

Yes

String

Caller device IP address, for example, 10.10.10.1

device_fingerprint

Yes

String

Caller device fingerprint. When the same user calls the API, values of this parameter must be the same, for example, 156aysdna213sc50.

agent

No

String

User agent information of the caller. For example, Mozilla/5.0 (Linux; Android 10; Redmi K30 Build/QKQ1.190825.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.99 Mobile Safari/537.36

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

session_token

String

User's new session token, which is used to call the SSO API to obtain sso_ticket. User information can be obtained through sso_ticket.

id_token

String

It is essentially a JWT token that contains user identity information. The token is valid for 2 hours by default and its validity period can be configured.

expire

Integer

Expiration time, in seconds.

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error details.

Example Requests

Refresh session_token whose value is r5y******LU1 after successful login.

POST https://{domain_name}/api/v2/tenant/sso/session-token/refresh

Authorization: Bearer 334963fc-1e4a-473b-9096-52a929140...
X-tenant-id: 08f770f51f80d2f40f38c00cb199fd21

{
  "session_token": "r5y******LU1",
  "operating_sys_version": "Android 10",
  "device_ip": "10.10.10.1",
  "device_fingerprint": "156aysdna213sac",
  "agent": "Mozilla/5.0 (Linux; Android 10; Redmi K30 Build/QKQ1.190825.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.99 Mobile Safari/537.36"
}

Example Responses

Status code: 200

Request successful.

{
  "session_token" : "lqI******JFH"
}

Status Codes

Status Code

Description

200

Request successful.

400

Invalid parameter.

Error Codes

See Error Codes.