Authentication
The 1GLOBAL API adopts OAuth 2.0 with Client Credentials as its authentication mechanism, ensuring secure access to protected resources on behalf of a client application.
Although the same token can be used in multiple API calls, please be aware that these tokens have a limited duration so you need to include refresh logic in the client code, so that the token gets refreshed automatically without breaking your processing sequence.
Below is an explanation of how to obtain an access token using the Client Credentials flow, accompanied by examples.
Fetch an Access Token
-
Obtain your client credentials: Refer Getting Access
-
Request an Access Token: To request an access token from the authorization server, initiate an HTTP POST request to the token endpoint. Include the following parameters:
grant_type
: Set toclient_credentials
.token_url
: authentication server endpoint.client_id
: Your organization's client ID.client_secret
: Your organization's client secret.
-
Receive the Access Token: Upon successful authentication, you receive an access token.
cURL Example
curl -X POST \
https://your-auth-server.com/token \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=client_credentials&client_id=your_client_id&client_secret=your_client_secret'
Postman Example
- Create a new request.
- In the Authorization tab, set type to
OAuth 2.0
. - Fill in the
Configure New Token
form with the following values:
- Grant Type: Client Credentials
- Access Token URL:
https://api.1global.com/auth/realms/enterprise-apis/protocol/openid-connect/token
- Client ID:
your_client_id
- Client secret:
your_client_secret
- Click
Get New Access Token
, a popup 'Authentication complete' appears. - In the
Manage Access Tokens
popup, selectUse Token
. Once you have a token value generated and added, it appears in the request headers. - Proceed with your request. The generated token is valid for 5 minutes.