Skip to main content

AccessToken-v2 2.0.0

Authentication

1. Prerequisites

  1. You should have registered in our developer portal. Check this link about how to register an Account.
  2. You should request access to the playground, sandbox and production environment using our Support page. Here is the link to support page to request access to our environments.
  3. You should have an App created in your account to get the client id and client secret. Check this link about how to create an App.

2. Get Access Token

Digital Realty uses token-based authentication to allow customers to access our API. The customers application will get a JWT token after successful authentication. The token should be passed as credential when calling any other API. The token tells the API that the bearer of the token has been allowed  to access the API.

See below the details to get the Access Token. The grant type = client_credentials is used to obtain an access token outside of the context of a user.

Get Access Token


The method can be used to retrieve an access token used as authorization for the DLR API's

 Method POST
End point /v2/auth/token
Headers Content-Type
Query Parameters n/a
Body client_id, client_secret, grant_type

 

Sample Curl Request

curl --location --request POST 'https://api.digitalrealty.com/v2/auth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=<client_id>' \
--data-urlencode 'client_secret=<client_secret>' \
--data-urlencode 'grant_type=client_credentials'

 

Headers

Field Name Mandatory Type Description
Content-Type true string Indicates the request body format.

value: [application/x-www-form-urlencoded]

 

Query Parameters

n/a

Body

Field Name Mandatory Type Description
client_id true string(64) The client id value that you retrieve after you register the App.
client_secret true string(64) The client secret value that you retrieve after you register the App.
grant_type true string(18) Specifies the authorization mechanism the client uses to retrieve tokens.

value: [client_credentials]

 

Sample JSON Response

{
    "access_token": "eyJhbGciOiJSUzI1NiIsIm1bnci",
    "expires_in": 3600,
    "token_type": "Bearer",
    "scope": ""
}

 

 Payload Description

Field Name Type Description
access_token string() This access token formatted as JWT is used to authorize against our APIs.
expires_in integer The access token is valid for the given number of seconds
token_type string(6) Represents how an access token will be generated and presented by the caller in the Authorization header
scope string(20) Specifies the scope of the access token.

Response Codes

Text (formatted, long)

Please check the Response Codes overview in case of any issues.


Need Help?

Have not found what you are looking for, please do not hesitate to reach out to us!

globe