Verify an access token
Verifies an access token provided in serialized form. Upon success, returns the token's subject.
Optionally, contextual information that may be required to verify token caveats can be provided in the request body:
- IP address of the token bearer - defaults to the requesting client's IP,
- identity token of the service which is handling the request - defaults to
null, - consumer's identity token - consumer defaults to the authenticated client
if valid token credentials are sent with this request, or
nullotherwise, - interface to which the token bearer has connected - defaults to
null(undefined interface), - information if data access caveats should be allowed in the token - defaults to
false.
If the token cannot be positively verified, HTTP code 4xx is returned with an error describing the reason of failure.
This operation has public access.
Example cURL requests
Verify an access token
curl -X POST https://$ZONE_HOST/api/v3/onezone/tokens/verify_access_token \
-H 'Content-type: application/json' \
-d '{"token": "MDAxNmxvY2F00aW9uIHZ2...", "peerIp": "38.190.241.12"}'
{
"subject": {
"type": "user",
"id": "1b510f18b3b05611871c0acdffa9aed4"
},
"ttl": 3600
}
Request body
The token to be verified and optional parameters.
The token in serialized form.
The IP address of the token bearer.
Identity token of the service that is processing the token being verified.
Identity token of the consumer that wishes to use the token being verified.
The interface to which the token bearer has connected as seen by the verifying party.
Indication if verifying party allows data access caveats in the token.
Request Examples
{
"token": "MDAxNmxvY2F00aW9uIHJlZ2lzdHJ5CjAwM2JpZGVudGlmaW",
"peerIp": "38.190.241.12",
"serviceToken": "JKzmG9uZXpvbmUKMDAzYmlkZW50aWZpZXIgOEhmSEFSSGdr",
"consumerToken": "MDAzYmlkZW50aWZpZXIgOEhmSEFSSGdrbHFCa1pWSTRsNk5",
"interface": "rest",
"allowDataAccessCaveats": false
}Responses
Successful token verification result.
subject object (TokenPropertySubject) The subject of the token - the user or Oneprovider in whose name the token was issued. The bearer (consumer) of the token adopts the subject's identity when accessing services with that token.
The subject of the token - the user or Oneprovider in whose name the token was issued. The bearer (consumer) of the token adopts the subject's identity when accessing services with that token.
Type of the subject
Id of the subject
Token's TTL in seconds (or null if infinite)
Example
{
"subject": {
"type": "user",
"id": "1b510f18b3b05611871c0acdffa9aed4"
},
"ttl": 3600
}Invalid request.
error object Object describing an error.
Object describing an error.
String identifying the error type. Does not change between error instances.
Human readable error description. May contain information specific to given error instance.
Details about the error instance. The object schema is specific to each error type.
Example
{
"error": {
"id": "badValueString",
"details": {
"key": "name"
},
"description": "Bad value: provided \"name\" must be a string."
}
}Authentication error.
error object Object describing an error.
Object describing an error.
String identifying the error type. Does not change between error instances.
Human readable error description. May contain information specific to given error instance.
Details about the error instance. The object schema is specific to each error type.
Example
{
"error": {
"id": "badValueString",
"details": {
"key": "name"
},
"description": "Bad value: provided \"name\" must be a string."
}
}Authorization error.
error object Object describing an error.
Object describing an error.
String identifying the error type. Does not change between error instances.
Human readable error description. May contain information specific to given error instance.
Details about the error instance. The object schema is specific to each error type.
Example
{
"error": {
"id": "badValueString",
"details": {
"key": "name"
},
"description": "Bad value: provided \"name\" must be a string."
}
}Resource not found.
error object Object describing an error.
Object describing an error.
String identifying the error type. Does not change between error instances.
Human readable error description. May contain information specific to given error instance.
Details about the error instance. The object schema is specific to each error type.
Example
{
"error": {
"id": "badValueString",
"details": {
"key": "name"
},
"description": "Bad value: provided \"name\" must be a string."
}
}Internal server Error.
error object Object describing an error.
Object describing an error.
String identifying the error type. Does not change between error instances.
Human readable error description. May contain information specific to given error instance.
Details about the error instance. The object schema is specific to each error type.
Example
{
"error": {
"id": "badValueString",
"details": {
"key": "name"
},
"description": "Bad value: provided \"name\" must be a string."
}
}