OAuth 2.0 Authentication
Purpose:
OAuth 2.0 is used to confirm the identity of the user making the request. This ensures that only authenticated users can access resources.
How it Works:
Get your Oauth2 credentials:
Obtain an Access Token:
Your client application initiates the OAuth 2.0 flow (client credentials grant) with the authorization server. See below examples on how to generate a token using command line or Postman.
Upon successful authentication, the authorization server issues an access token.
Include the Token in the Authorization Header:
- The client application includes the access token in the
Authorizationheader of each API request, formatted asBearer.
- The client application includes the access token in the
Example of request including the Auth token in the Authorization header:
curl --location 'https://api.staging.smartdocflow.com/v1/exchange/file/submission?account=testuser1&destinations=testuser2' \
--header 'Content-Type: application/json' \
--header 'Authorization: eyJraWQiOiJGNFkwQmZLZkhnSmtSMjBGck1Ia3RyNTlNVTJjTUx5RlhZZUZ6WVNESFkwPSIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiIyMWRqZHJnN2xldDdhMW91cWtja3VhODQxcCIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoic21hcnRkb2NmbG93XC9yZWFkIHNtYXJ0ZG9jZmxvd1wvd3JpdGUiLCJhdXRoX3RpbWUiOjE3NDQxNjQ2NTAsImlzcyI6Imh0dHBzOlwvXC9jb2duaXRvLWlkcC5ldS1jZW50cmFsLTEuYW1hem9uYXdzLmNvbVwvZXUtY2VudHJhbC0xX2duR1RWbGNNcSIsImV4cCI6MTc0NDE2ODI1MCwiaWF0IjoxNzQ0MTY0NjUwLCJ2ZXJzaW9uIjoyLCJqdGkiOiI1NTJlMWZlOS1kNDRhLTRjZmEtYTk3YS1mYzE2NDk2NDM4ZGUiLCJjbGllbnRfaWQiOiIyMWRqZHJnN2xldDdhMW91cWtja3VhODQxcCJ9.JSddi1oh7h3ydp8XKm8XxGanKiQXHYbjrL1JZYKlhSGzKfKCSEA10Inuwhk3NzMT1we4pidH2ENJ1u8xk3ROey62HadeKifm8BV9OPZIh0gifLsRMLLsrQsKQXckh11TcrIwI5_cedZN_p31nF7wJ08W5ctezHHciHd6oOoC44lbPwIkbtWTX1ChOr5qaTVb0-zyuetjd7diu60o-0pDnabDcrYRDgcr0Esx12yv27r3CxowITAFVgVkXdRWkjNqScJIEvNcXRIrtdeQhL7YiQY60AiLTvzSXuqHsIsOExm11sO-uMipvx_HT53kY1-e-m3uNkT-yUqkFvHGH3OrbA' \
--data '{
"filename": "Example.txt",
"checksum": "3ff91d026cbb5bceafec30bf8b7c26ab",
"content": "VGhpcyBpcyBhIHNhbXBsZSBmaWxlIGNvbnRlbnQgZm9yIGRlbW8gcHVycG9zZSBvbmx5LiByZXBsYWNlIHdpdGggeW91ciByZWFsIGZpbGUgY29udGVudC4="
}'Examples of Token generation
How to create token with CURL in command line
Example of generating a token for Staging:
curl --location --request POST "https://accounts.staging.smartdocflow.com/oauth2/token" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "grant_type=client_credentials" \
--data-urlencode "client_id=12qbfa57skm7gcl6dct16d8jc7" \
--data-urlencode "client_secret=********" \
--data-urlencode "scope=smartdocflow/read smartdocflow/write"How to create token using Postman
Configure OAuth 2.0:
Go to the "Authorization" tab in Postman.
Select "OAuth 2.0" from the "Type" dropdown.
Configure the OAuth 2.0 settings according to your API's requirements:
Grant Type: Select the appropriate grant type. choose Client Credentials.
Access Token URL: The URL to exchange the authorization code for an access token.
Client ID: Your client application's ID .
Client Secret: Your client application's secret.
Scope: add needed scopes. Example "smartdocflow/read smartdocflow/write".
Click "Get New Access Token" to obtain a valid access token.
If the request is successful, a new token is created. click use token to start using it.
- Postman will then automatically add the
Authorization: Bearerheader to your requests (where Bearer is your token value).
- Postman will then automatically add the