Get API Keys

In order to use Totogi API Platform APIs, you should use your credentials to get an access token which is required for every API call. Totogi API Platform uses Oauth2 for authorization. Following steps describe how you can retrieve access tokens using your credentials and the client ID.

Getting an Access Token from the Command Line

  1. Create a file called auth.json that contains your username, password & client id. Example:
Copy
Copied
{
  "AuthParameters": {
    "USERNAME": "mbreslow@verizon.com",
    "PASSWORD": "Snack@tack83271"
  },
  "AuthFlow": "USER_PASSWORD_AUTH",
  "ClientId": "s9gwjl9mbz4gsqqczdbagnvzjk"
}
  1. Obtain tokens from AWS Cognito
Copy
Copied
curl -X POST --data @auth.json -H "X-Amz-Target: AWSCognitoIdentityProviderService.InitiateAuth" -H "Content-Type: application/x-amz-json-1.1" https://cognito-idp.us-east-1.amazonaws.com/

The output is a JSON document like this one:

Copy
Copied
{
  "AuthenticationResult": {
    "AccessToken": "eyJraWQiOiJ2XC84Vn...",
    "ExpiresIn": 86400,
    "IdToken": "eyJraWQiOiJYNTBtQ001...",
    "RefreshToken": "eyJjdHkiOiJKV1Q...",
    "TokenType": "Bearer"
  },
  "ChallengeParameters": {}
}
  1. Extract the AccessToken from the AuthenticationResult. You can use the jq command
Copy
Copied
curl -X POST --data @auth.json -H "X-Amz-Target: AWSCognitoIdentityProviderService.InitiateAuth" -H "Content-Type: application/x-amz-json-1.1" https://cognito-idp.us-east-1.amazonaws.com/ | jq -r ".AuthenticationResult.AccessToken"