ข้ามไปที่เนื้อหา

Authorization

Authorize user

Authorize user

Authorize a user with a web browser by sending them through the Dimdata website and request their permission to act on their behalf.

Use your clientID and redirectURI from your registered application.

An authorization_code will return to your redirectURI

https://account.dimdata.com/connect/authorize?client_id=[clientID]&redirect_uri=[redirectURI]&scope=email dimdataApi offline_access&response_type=code&response_mode=query

Request access token

POST https://account.dimdata.com/connect/token

Request an Access Token using a client-side obtained OAuth 2.0 authorization code

Sample request:

curl --request POST 'https://account.dimdata.com/connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'code=[authorization_code]' \
--data-urlencode 'client_id=[clientID]' \
--data-urlencode 'redirect_uri=[redirectURI]' \
--data-urlencode 'scope=email dimdataApi offline_access'
POST /connect/token
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&code=%5Bauthorization_code%5D&client_id=%5BclientID%5D&redirect_uri=%5BredirectURI%5D&scope=email%dimdataApi%20offline_access

Response:

{
"access_token":"eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZDQkMtSFM ...",
"expires_in": 3600,
"id_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjVBNUZENDBDME ...",
"refresh_token":"eyJhbGciOi8mWIiOiI3Yjk1ODljZS0yOTg5LTQ4YmEtYTM ...",
"scope": "openid profile email dimdataApi offline_access",
"token_type": "Bearer"
}

Responses
200: OK Return access token and refresh token
400: Bad Request An authentication error
401: Unauthorized Validation Failed

Refresh access token

POST https://account.dimdata.com/connect/token

Refresh an Access Token using its client ID, secret, and refresh token.

Sample request:

curl --request POST 'https://account.dimdata.com/connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=refresh_token' \
--data-urlencode 'refresh_token=eyJhbGciOi8mWIiOiI3Yjk1ODljZS0yOTg5LTQ4YmEtYTM ...' \
--data-urlencode 'client_id=[clientID]'
POST /connect/token
Content-Type: application/x-www-form-urlencoded

grant_type=refresh_token&client_id=dimdataclient&refresh_token=eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZDQkMtSFM1MTIiLCJraWQiOiI1QTVGRDQwQzBGNzU0NTFCNTY4NDdGMDg1ODE2NDNDODRBM0Q5MkVDIiwidHlwIjoib2lfcmVmdCtqd3Qif%20...

Response:

{
"access_token":"eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZDQkMtSFM ...",
"expires_in": 3600,
"id_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjVBNUZENDBDME ...",
"refresh_token":"eyJhbGciOi8mWIiOiI3Yjk1ODljZS0yOTg5LTQ4YmEtYTM ...",
"scope": "openid profile email dimdataApi offline_access",
"token_type": "Bearer"
}

Responses
200: OK Return new access token and new refresh token
400: Bad Request An authentication error
401: Unauthorized Validation Failed