Types of Authentication
S&P Global Commodity Insights offer two different authentication methods for using APIs. Please find below the two authentication options.
Basic Authentication:
For this authentication method, users provide their Username/Email ID and Password for access.
How it works:
- Users provide their encoded Username/Email ID and Password along with their API request.
- The API checks your credentials against its database. If they are valid, you gain access to the requested resources.
- After successful authentication, you will receive a session token for future requests.
curl -X GET https://api.ci.spglobal.com/endpoint -H "Authorization: Basic username:password"
- Many applications, like Microsoft PowerBI and Excel, automatically handle this encoding. See the PowerBI tab for more information.
- If your application doesn’t handle encoding, you can use tools like Postman or Base64 Encoder. The encoded username and password will look similar to this: dXNlcjpwYXNz.
curl -X GET https://api.ci.spglobal.com/endpoint -H "Authorization: Basic dXNlcjpwYXNz"
Token-Based Authentication:
In this type of authentication, the API requires an Authentication Token (also called Access Token) for access. The Authentication Token acts as a proof of your identity or authorization to access specific data.
How it works
- Initiate the authentication process by providing your credentials (e.g., username and password) to an authentication service which is there in Token Generation in Service Catalog page.
- The authentication service validates the credentials and issues an Authentication Token to you if the credentials are correct and authorized.
- You send the Authentication Token in the request headers for every API call. For example: Authorization: Bearer "YOUR_AUTH_TOKEN"
- The API validates the Authentication Token with the authentication service to ensure it is still valid and authorized.
- If the token is valid and authorized, the API responds to the request with the requested data or performs the specified action.
curl -X GET https://api.ci.spglobal.com/endpoint -H "Authorization: Bearer YOUR_AUTH_TOKEN"
Note:
In Service Catalog & API Data Explorer users are now automatically
authenticated to datasets they have access to. This means that now users
no
longer need to manually input tokens into the authorization box. If a
user is
logged in and has access to a particular dataset, they can execute
actions
within that dataset seamlessly without the need for generating a token
or
filling in authorization details. The system will automatically
authenticate the
user by checking their access permissions.
However, if users prefer
or
require manual token generation for any reason, the detailed steps are
as
follows Token Generation.