All Squirro API resources are protected and authentication credentials for HTTP authentication (using the Authorization header) are mandatory. The caller needs to use generated user tokens with HTTP Basic access authentication or use bearer tokens in HTTP requests to access the protected resources.
Table of Contents
To authenticate with the Squirro platform the caller needs a user token. That token can be generated in the "API Access" section of the Squirro settings. The resulting user token provides access according to the rights of the user.
Using the Token in the API
In the context of the API the user token is called a refresh token. To use the API, a refresh token can not be used directly, instead an access token needs to be generated. The access token expires very quickly (10 minutes by default) where the refresh token does not expire.
Create Access Token
Log into Squirro using a refresh token.
- grant_type – Set to
- refresh_token – The user's refresh token.
|Headers:||See Common Headers.|
- 404 – Invalid refresh token.
- 410 – Refresh token expired (e.g. token was expired due to security reason).
See also Common Status Codes.
A new user session. The
access_token field can be used for further API requests.
The role permissions show the permissions, the user has in the tenant.
Use Access Token
To use the access token with any of the API requests (see Working with Squirro APIs), the access token needs to be passed in with the
Authorization header, prefixed with the token "Bearer".
Example HTTP request:
GET /api/topic/v0/squirro_demo/projects HTTP/1.1
Authorization: Bearer 882d9b12cce019ee0137e54beaeea2227db4db3e
The Python SDK handles all of the authentication logic automatically. Initially authenticate using the refresh token by using the
client = SquirroClient(None, None, cluster='https://squirro-server')
The client will retrieve a authentication token and use that for all subsequent requests. When the token expires, the client will re-authenticate using the refresh token and retry the failed request.