Generate access token and refresh token
- Last Updated: February 2, 2024
- 1 minute read
- Hybrid Data Pipeline
- Version 5.0
- Documentation
Purpose
Generates the access token and the refresh token.
URL
https://<myserver>:<port>/oauth2/token
Method
POST
URL Parameters
<myserver> is the hostname or IP address of the machine hosting the Hybrid Data Pipeline server for a non-load balancer deployment, or the machine hosting the load balancer for a load balancer deployment. For a non-load balancer deployment, <port> is the port number specified as the Server Access Port during deployment. For a load balancer deployment, <port> must be either 80 for http or 443 for https. Whenever port 80 or 443 are used, it is not necessary to include the port number in the URL.
Payload Parameters
When the grant type is refresh_token, the
following payload parameters are required.
{
"grant_type": "refresh_token",
"scope":"api.access.odata",
"refresh_token":"refresh-token",
"clientId":"client-id",
"clientSecret":"client-secret",
}
| Property | Description | Valid Values |
|---|---|---|
| "grant_type" | The grant type used for OAuth flow | This can be either password or
refresh_token. In this case, it is
refresh_token. |
| "scope" | An OAuth 2.0 scope specifies the resources that can be accessed by client applications. | Currently, the only supported scope is api.access.odata. |
| "refresh_token" | The refresh token that had been issued to the application. | A valid refresh token issued by Hybrid Data Pipeline. |
| "clientId" | The client ID is generated when the client application is registered. This ID is required when client applications initiate OAuth authorization. | An auto-generated value used when client applications initiate OAuth authorization. |
| "clientSecret" | The client secret is generated when the client application is registered. This secret is required when client applications initiate OAuth authorization. | An auto-generated value used when client applications initiate OAuth authorization. |
When the grant type is password, the following
payload parameters are required.
{
"grant_type": "password",
"scope":"api.access.odata",
"clientId":"client-id",
"clientSecret":"client-secret",
"username":"hdp-username",
"password":"hdp-password"
}
| Property | Description | Valid Values |
|---|---|---|
| "grant_type" | The grant type used for OAuth flow | This can be either password or
refresh_token. In this case, it is
password. |
| "scope" | An OAuth 2.0 scope specifies the resources that can be accessed by client applications. | Currently, the only supported scope is api.access.odata. |
| "clientId" | The client ID is generated when the client application is registered. This ID is required when client applications initiate OAuth authorization. | An auto-generated value used when client applications initiate OAuth authorization. |
| "clientSecret" | The client secret is generated when the client application is registered. This secret is required when client applications initiate OAuth authorization. | An auto-generated value used when client applications initiate OAuth authorization. |
| "username" | User ID | The Hybrid Data Pipeline user ID. |
| "password" | User password | The Hybrid Data Pipeline user password. |
Sample Request Payload
{
"grant_type": "refresh_token",
"scope":"api.access.odata",
"refresh_token":"u67rkot4drt5ieigfd0bce58f",
"clientId":"eeee5555-66dd-7777-9999-fffff333333c",
"clientSecret":"9999tttt-gg22-1212-0606-bbbbb444444z"
}
Sample Server Success Response
Status code: 200
Created
{
"access_token": "fdb8fdbecf1d03ce5e612ng",
"refresh_token": "u67rkot4drt5ieigfd0bce58f",
"expires_in": "3599"
}
Sample Server Failure Response
{
"error":{
"code":222206628,
"message":{
"lang":"en-US",
"value":"Problem creating OAuth Client Application at this time. Please try again at another time."
}
}
}
Authentication
Basic Authentication using Login ID and Password
Authorization
Any active Hybrid Data Pipeline user