Check Token Validity
Check whether the current user's token is valid. If the token is valid, return true; if it is invalid or has expired, return false.
# Request Description
POST https://{your_domain}/api/v1/oauth2/introspect
# Request Headers
| Parameter Name | Chinese Name | Required | Example Value | Description |
|---|---|---|---|---|
| Authorization | Authentication Information | Required | Basic UnFCMkOWk9xWA== | Use client_id and client_secret for basic64 authentication, format: base64(client_id:client_secret) |
| Content-Type | Data Type | Required | application/x-www-form-urlencoded | Submit parameters using form data |
# Request Example
POST https://{your_domain}/api/v1/oauth2/introspect
Authorization: Basic UnFCMkhKdGt6bFU...aT0NObkk4NlNOWk9xWA==
Content-Type: application/x-www-form-urlencoded
token=MmVkMTIyNGUzODBkYjY3UV4nmxKh4z....&token_type_hint=access_token
# Request Parameters
| Parameter Name | Chinese Name | Required | Example Value | Description |
|---|---|---|---|---|
| token | Token | Yes | ||
| token_type_hint | Optional | Defaults to access_token |
# Response Example
When the token is valid, a successful response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"active": true,
"token_type": "bearer",
"scope": "openid profile",
"client_id": "J8NFmU4tJVgDxKaJFmXTWvaHO",
"username": "zhangsan",
"exp": 1437275311
}
When the token is invalid or expired, a successful response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"active": false,
}
Error response example
HTTP 401 Unauthorized
Content-Type: application/json;charset=UTF-8
{
"error": "invalid_client",
"error_description": "Bad client credentials"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Response Parameters
If the request is successful, the Access Token can be obtained from the response information.
| Parameter Name | Chinese Name | Required | Description |
|---|---|---|---|
| active | Token Status | Required | true indicates the token is valid; false indicates the token is invalid or expired |
| token_type | Token Type | Optional | |
| scope | Authorization Scope | Optional | |
| client_id | Application Client ID | Optional | |
| username | Username | Optional | |
| exp | Expiration Time | Optional | Unix timestamp |
I am ready. Please provide the Markdown content you would like me to translate.
