Users Guide

Table Of Contents
REST Token-Based Authentication Limitations
The following limitations are applicable in 10.5.1:
REST token authentication is disabled when FIPS mode is enabled.
Acquire new token
You can acquire a new token by calling the Login REST API. A successful Login API call using the basic authentication generates
a new set of token.
$ curl -X GET -k -u admin:admin -H "Content-Type: application/json" https://$TARGET/
login
{
"access_token": "abc.123.xyz",
"token_type": "bearer",
"refresh_token": "efg.456.uvw"
}
On successful login, JSON data returns 'access_token' and 'refresh_token' as keys. You can parse the data and save the token
values for subsequent requests.
$ export ACCESS_TOKEN="abc.123.xyz"
$ export REFRESH_TOKEN="efg.456.uvw"
The following is an example of a RS256 signed token:
"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiZXhwIjoxNTUzNjcyMjcxfQ.
nDydDFFjLju6jYuR9waxmvVZ6iVHoJZSrqey2p3S_0B_fD5U2GU8tOjTr3paJ3Wvs1a3TQpKQ_xAp-9zxBwUoJFTC
2qjKH6uMgTgfWxltrfcb3_9JF1SIsyGHaT-oUzcdCmC47TlXRIRLzcZ9w4Q5vFqxKYv1sRA47T9sSnAZac"
Access token
You can use the HTTP Bearer Authentication to pass the access token to subsequent REST API requests. You can do this using
the HTTP Authorization header with syntax 'Authorization: Bearer <TOKEN>' .
The following is the output of the command:
$ curl -X GET -k -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-
Type: application/json" https://$TARGET/restconf/data/dell-system:system/hostname {"dell-
system:hostname":"OS10"}
Refresh token
You can use the HTTP Bearer Authentication with the same Login REST API to acquire a new access token. Place the same
refresh token available in the authorization header in the 'refresh_token' key of output data.
$ curl -X GET -k -H "Authorization: Bearer $REFRESH_TOKEN" -H "Content-Type: application/
json" https://$TARGET/login
{
"access_token": "ijk.978.rst",
"token_type": "bearer",
"refresh_token": "efg.456.uvw"
}
The validity of the refresh token is equal to the validity of the access token multiplied by the refresh limit.
1748
RESTCONF API