Get named token of current user by name
Returns the information about a user's named token by token name.
This operation can be invoked on behalf of the current user only.
You can learn more about named and temporary tokens here.
Example cURL requests
Get named token of current user by name
curl -u username:password -X GET \
https://$HOST/api/v3/onezone/user/tokens/named/name/my-token-1
{
"id": "2b5d0dd5aa6443a69277b5ce0544fec2",
"name": "my-token-1",
"subject": {
"type": "user",
"id": "c26bab23d12f7389c3c311caf9c15902"
},
"type": {
"inviteToken": {
"inviteType": "userJoinCluster",
"clusterId": "fb73f7ceff5abd995357abbe01c812ce"
}
},
"caveats": [
{
"type": "time",
"validUntil": 1571147494
},
{
"type": "ip",
"whitelist": [
"189.34.15.0/8",
"127.0.0.0/24",
"167.73.12.17"
]
}
],
"metadata": {
"creationTime": 1564721024,
"usageLimit": 15,
"usageCount": 3,
"privileges": [
"space_view",
"space_read_data",
"space_view_views",
"space_view_statistics"
],
"custom": {
"jobName": "experiment-15",
"vm": "worker156.cloud.local"
}
},
"revoked": false,
"token": "MDAxNWxvY2F0aW9uIG9uZXpvbmUKMDAzYmlkZW50aWZpZXIgOEhmSEFSSGdrbHFCa1pWSTR"
}
Path parameters
| Parameter | Type & Description |
|---|---|
| name required | string Token name |
Request Examples
onezone-rest-cli getNamedTokenOfCurrentUserByName name==my-token-1Responses
Returns the details of a specific named token.
| Property | Type & Description | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id string (TokenPropertyId) Unique identifier of the token | |||||||||||||||||||||||||||||||||||||||
name string (TokenPropertyName) Token name (unique for subject user/provider) | |||||||||||||||||||||||||||||||||||||||
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.
| |||||||||||||||||||||||||||||||||||||||
type object (TokenPropertyTokenType) The type of the token (object) Enum: {accessToken: {}}{identityToken: {}}{inviteToken: {"...": "..."}}
| |||||||||||||||||||||||||||||||||||||||
caveats array of objects (Caveat) A list of caveats that confine the token.
| |||||||||||||||||||||||||||||||||||||||
metadata object (TokenPropertyMetadata) Metadata describing the token
| |||||||||||||||||||||||||||||||||||||||
revoked boolean (TokenPropertyRevoked) Determines if this token is revoked (cannot be used) - can be toggled at will | |||||||||||||||||||||||||||||||||||||||
token string (SerializedToken) The token in serialized form. | |||||||||||||||||||||||||||||||||||||||
Example
{
"id": "2b5d0dd5aa6443a69277b5ce0544fec2",
"name": "my-token-1",
"subject": {
"type": "user",
"id": "1b510f18b3b05611871c0acdffa9aed4"
},
"type": {
"inviteToken": {
"inviteType": "userJoinCluster",
"clusterId": "fb73f7ceff5abd995357abbe01c812ce"
}
},
"caveats": [
{
"type": "time",
"validUntil": 1571147494
},
{
"type": "ip",
"whitelist": [
"189.34.15.0/8",
"127.0.0.0/24",
"167.73.12.17"
]
}
],
"metadata": {
"creationTime": 1564721024,
"usageLimit": 15,
"usageCount": 3,
"privileges": [
"space_view",
"space_read_data",
"space_view_views",
"space_view_statistics"
],
"custom": {
"jobName": "experiment-15",
"vm": "worker156.cloud.local"
}
},
"revoked": false,
"token": "MDAxNWxvY2F0aW9uIG9uZXpvbmUKMDAzYmlkZW50aWZpZXIgOEhmSEFSSGdrbHFCa1pWSTR"
}Invalid request.
| Property | Type & Description | ||||||
|---|---|---|---|---|---|---|---|
error object Object describing an error.
| |||||||
Example
{
"error": {
"id": "badValueString",
"details": {
"key": "name"
},
"description": "Bad value: provided \"name\" must be a string."
}
}Authentication error.
| Property | Type & Description | ||||||
|---|---|---|---|---|---|---|---|
error object Object describing an error.
| |||||||
Example
{
"error": {
"id": "badValueString",
"details": {
"key": "name"
},
"description": "Bad value: provided \"name\" must be a string."
}
}Authorization error.
| Property | Type & Description | ||||||
|---|---|---|---|---|---|---|---|
error object Object describing an error.
| |||||||
Example
{
"error": {
"id": "badValueString",
"details": {
"key": "name"
},
"description": "Bad value: provided \"name\" must be a string."
}
}Resource not found.
| Property | Type & Description | ||||||
|---|---|---|---|---|---|---|---|
error object Object describing an error.
| |||||||
Example
{
"error": {
"id": "badValueString",
"details": {
"key": "name"
},
"description": "Bad value: provided \"name\" must be a string."
}
}Internal server Error.
| Property | Type & Description | ||||||
|---|---|---|---|---|---|---|---|
error object Object describing an error.
| |||||||
Example
{
"error": {
"id": "badValueString",
"details": {
"key": "name"
},
"description": "Bad value: provided \"name\" must be a string."
}
}