Generating a service account token
Call the /security/oauth/token endpoint to generate a token for
a service account.
Before you begin
- The service account for which you generate a token must already exist.
- You have combined the ID and the secret of this service account in the following
format: ID:secret and encoded this pair in a Base64 encode
application of your choice.
Talend API Tester provides a native tool to do the Base64 encoding. If you use Talend API Tester to test this use case, follow Adding the Authorization header to encode your ID:secret pair.
About this task
In this section, the following API call is
issued:It
is implemented in Talend API Tester
for demonstration purposes.
method: POST
endpoint: https://api.<env>.cloud.talend.com/security/oauth/token
headers: {
"Content-Type": "application/json",
"Authorization": "Basic <encoded_Base64_value_of_id-secret_pair>"
}
payload: {
"audience":"https://api.<env>.cloud.talend.com",
"grant_type":"client_credentials"
}
Procedure
Results
What to do next
- Reactive: assume that the token is valid in every request and take action when you receive the response saying 401 unauthorized.
- Proactive: once generated, a token is valid for 30 minutes. Be aware of the expiration time and renew the token accordingly.
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!