Authentication Process
DTO API Authentication & Authorization details
Each endpoint within DTO API requires an authentication token that is generated against user credentials issued to each client. A client application must send a valid token in the authorization header of the HTTP request to our API. The authentication gateway validates the authentication token, and processes the request as per the request if the user is successfully authenticated.
Please note that while we refer to the DTO APIs, the APIs work for both DTO and essCert.
Securing User Credentials
Your User Credentials carry many privileges, so be sure to keep them secure! Do not share the credentials in publicly accessible areas such as GitHub, client-side code, and so forth.
Generating Authentication Token
Each client has a valid username and password against which the API provides a valid authentication token. Here is how a usual cURL looks like to generate an Authentication Token against a valid user.
curl --location --request POST 'https://api.tradecert2.net/auth/v1/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'username=adamusclient' \
--data-urlencode 'password=diooigdf1989D'
Here is how the access token output looks when requested.
{
"AccessToken": "eyJraWQiOiJDeHBweFAycjhtSm5xRnVicjVQQm5QU2RoWmFtK1JpakJkcU9CNTlGVVwvdz0iLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJhYzA1ZTk2MS1hZWI2LTQ5NTMtOTVjNy02NjMwOGFmNTQ2ODAiLCJldmVudF9pZCI6IjhjYWQ3NjVkLWM0YTYtNGE0My1iNjMxLTdmOGUxYzM0ODFiMiIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoiYXdzLmNvZ25pdG8uc2lnbmluLnVzZXIuYWRtaW4iLCJhdXRoX3RpbWUiOjE2Mzg5MDA0ODAsImlzcyI6Imh0dHBzOlwvXC9jb2duaXRvLWlkcC5ldS13ZXN0LTEuYW1hem9uYXdzLmNvbVwvZXUtd2VzdC0xXzVkUWhLMWxqSCIsImV4cCI6MTYzODkwNDA4MCwiaWF0IjoxNjM4OTAwNDgwLCJqdGkiOiI0NzZhNzllNS00MWNlLTQxOTItYjE4Zi1iZTlkZmZmMGE3NmMiLCJjbGllbnRfaWQiOiIxdWxmdnUycDhhZnN2Z2VwcGdrOXNiMDExcCIsInVzZXJuYW1lIjoiam9obmF1c2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iOiIrQzFqYkhSZ1ZiZkZHcEh5VzkrTmkwMG50eWtydmkxZmY3eVJQNlUyZDZJPSIsImFsZyI6IlJTMjU2In0.eyJjdXN0b206dGVuYW50SWQiOiJ0ZXN0Iiwic3ViIjoiYWMwNWU5NjEtYWViNi00OTUzLTk1YzctNjYzMDhhZjU0NjgwIiwiYXVkIjoiMXVsZnZ1MnA4YWZzdmdlcHBnazlzYjAxMXAiLCJldmVudF9pZCI6IjhjYWQ3NjVkLWM0YTYtNGE0My1iNjMxLTdmOGUxYzM0ODFiMiIsInRva2VuX3VzZSI6ImlkIiwiYXV0aF90aW1lIjoxNjM4OTAwNDgwLCJpc3MiOiJodHRwczpcL1wvY29nbml0by1pZHAuZXUtd2VzdC0xLmFtYXpvbmF3cy5jb21cL2V1LXdlc3QtMV81ZFFoSzFsakgiLCJjb2duaXRvOnVzZXJuYW1lIjoiam9obmF1c2NsaWVudCIsImV4cCI6MTYzODkwNDA4MCwiaWF0IjoxNjM4OTAwNDgwfQ.QfJXrDSn_nRGrTSQLSxG4aY5G2wxYMJ9-NFhN5lVFmR4MEJxGBlOgN-VdElTMJBYQ54vXpP4Xo2Ch9aMtYd7l-TX1mefSqDdrVVSAQ-dFz7eHtJnGb6aTdq-G73oQxItaHl4S0-vbHrdUou5NS1bw6kvtg27UX8FX18NCv_fd5ZLjcyWxGn4_fF_GDKbwlFX43Uv3DwGJ63Se_PnM8yHwwLCukIsAMzwC86W3Vgq0s9U5n_xTJY4Sf-eVNJ20Dqvz503EwOcGkcQcuUv9NKm3Sg_5LKU0m0dJEBqlDS17sNQfc-aEdEAl2iEXw0Lpi-YJ54T-DC32ImCg2CPni4_Kg"
}
- AccessToken: Access Token used to execute the other endpoints.
- ExpiresIn: Provides token expiry time in seconds.
- TokenType: Implemented token type technology used. The token's endpoint must be appended with the Bearer tag.
- RefreshToken: The Refresh Token is used with
username
to generate a new Access Token if required. - IdToken: The ID token is a JSON web token (JWT) that contains claims about the identity of the authenticated user such as name, email, and phone_number.
Using Acces Token or Id Token
AccessToken or IdToken can be used to access the API. The
IdToken
has more claims available than theAccessToken
.
Please refer Generates Auth Token to test out the endpoint against your staging credentials.
Token Validity
Each generated token is valid for 3600 seconds / 24 hours. This value can be retrieved from ExpiresIn field within the response.
Using Authentication Token
Once an authentication token is generated, it can be used for 24 hours to consume any available endpoint. Here is a cURL of using the token for authentication.
curl --location --request GET 'https://api.tradecert2.net/api/v1/cert/CO/58AB7810/issue' \
--header 'Authorization: Bearer eyJraWQiOiJDeHBweFAycjhtSm5xRnVicjVQQm5QU2RoWmFtK1JpakJkcU9CNTlGVVwvdz0iLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJhYzA1ZTk2MS1hZ' \
--header 'Content-Type: application/json'
Updated about 1 year ago