Skip to content

Authentication API

TruEra validates your identity when you attempt to make a connection, employing an authentication protocol that sends your credentials — either a TruEra-generated bearer token or login credentials — from your machine to TruEra's remote access server.

Bearer Token Auth

Requests are authenticated using a Bearer token generated during installation by clicking on "Generate Credentials" (see Connecting to TruEra). The auth token will look similar to this:

eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJUcnVFcmFfVG9rZW5fSXNzdWVyIiwiaWF0IjoxNjUxNjk0OTg3LCJleHAiOjE2NTE3ODEzODcsInN1YiI6IjY2Mjc2Mjc2LTRlODUtNTBhMy04N2EyLWY5OTEzNTE3MWJlOCIsImlkIjoiNjYyNzYyNzYtNGU4NS01MGEzLTg3YTItZjk5MTM1MTcxYmU4IiwibmFtZSI6ImFpbGVucyIsImVtYWlsIjpudWxsfQ.TQB0WjoljNo0aVjTPSQc8n5ZEZiNUyPFZHb3YRYullLS1P7aLidKD5GDMYeulheUETN3_zzpe4OSTV4tiaaBCA

Once the token is obtained, it can be attached to the request with the header Authorization: Bearer <token>. For example, the auth header for the example token above would be:

Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJUcnVFcmFfVG9rZW5fSXNzdWVyIiwiaWF0IjoxNjUxNjk0OTg3LCJleHAiOjE2NTE3ODEzODcsInN1YiI6IjY2Mjc2Mjc2LTRlODUtNTBhMy04N2EyLWY5OTEzNTE3MWJlOCIsImlkIjoiNjYyNzYyNzYtNGU4NS01MGEzLTg3YTItZjk5MTM1MTcxYmU4IiwibmFtZSI6ImFpbGVucyIsImVtYWlsIjpudWxsfQ.TQB0WjoljNo0aVjTPSQc8n5ZEZiNUyPFZHb3YRYullLS1P7aLidKD5GDMYeulheUETN3_zzpe4OSTV4tiaaBCA

Basic Auth (Username/Password)

Requests can also be authenticated by passing in a TruEra username and password via Basic Auth. For example, a user with username username1 and password password1 would make requests with the header Authorization: Basic dXNlcm5hbWUxOnBhc3N3b3JkMQ==, where dXNlcm5hbWUxOnBhc3N3b3JkMQ== is the Base64 encoding of username1:password1.

Service Account Auth

Requests can be additionally authenticated using a token obtained with your Service Account credentials. For example, a service account that has a client_id of eb399605-959b-4362-985b-bcb1ae8913b6 and client_secret of DzbueNvWtRWpbhhPlQj366I3TJYwHFm5 can obtain a token by making a POST request to /oauth/token with a x-www-form-urlencoded body of client_id=eb399605-959b-4362-985b-bcb1ae8913b6 and client_secret=DzbueNvWtRWpbhhPlQj366I3TJYwHFm5.

The example cURL would be:

curl --request POST '<DEPLOYMENT_URL>/oauth/token' \
     --header 'Content-Type: application/x-www-form-urlencoded' \
     --data-urlencode 'client_id=eb399605-959b-4362-985b-bcb1ae8913b6' \
     --data-urlencode 'client_secret=DzbueNvWtRWpbhhPlQj366I3TJYwHFm5'

The response from TruEra will include an access token for authentication. See Bearer Token Auth above for more information on authenticating requests using a token.