Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Overview

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.

User Token Generation

To authenticate with the Squirro platform the caller needs a user token which can be generated on behalf of a specific user by visiting https://squirro.com/app/#settings/api (see Endpoint Mapping for more information). A user token limits the allowed operation to the corresponding user.

For regular access to the Squirro API the generated token is sufficient. Sample use cases of how the generated user token is used are illustrated in the API Tutorial.

Bearer Token Creation

Instead of using a generated user token for each request a new bearer token can be obtained for the corresponding user by issuing the following request.

    client = SquirroClient(None, None, cluster='https://squirro_enpoint')
    client.authenticate(refresh_token='<user_token>')
    

Alternatively, a new bearer token can be obtained for the corresponding username and password by issuing the following request. The previously registered client identifier and client secret need to be provided (see Registration).

    client = SquirroClient(client_id='<client_id>', client_secret='<secret>')
    client.authenticate(username='<user>', password='<pwd>')
    

An example return value for a successful authentication attempt with the Squirro platform is shown below. The access token is to be included in every request towards the Squirro API.

    {
       "access_token": "4c74cd262b916a511cb86a5c8e7c7bd7a2ccc5d9",
       "refresh_token": "9c39aef3f4c88a57dc26f8941bf7d25772a2891f5080f3c74bafd8708eb395c25c938d4417fb57c47bbb25211d4f49f5634ae848b8e012dcf867522385de48a6",
       "session_id": "M6vkL3dTRE6GREjwA5jnCg",
       "tenant": "squirro",
       "user_id": "8ZqzeXUnT_qq0xF1ym7m7A"
    }
    

Bearer Token Renewal

Each access token expires after ten minutes. The refresh token is used to get a new access token. By default the refresh token expires after a year.

    client = SquirroClient(client_id='<client_id>', client_secret='<secret>')
    client.authenticate(refresh_token='<refresh_token>')
    

Registration

To access the full functionality of the Squirro platform, namely login with user's email and password combinations, a client identifier and client secret is needed. It is to be requested by contacting the Squirro support. For regular API access to the Squirro platform this is not needed.

  • No labels