Using the API to provide access with OAuth application and profile objects
- Last Updated: April 11, 2025
- 2 minute read
- Hybrid Data Pipeline
- Version 4.6
- Documentation
You may provide access to a data store by creating OAuth application and profile objects in the Hybrid Data Pipeline API. Three distinct requests must be made to implement OAuth access using application and profile objects. First, the application object must be created. Next, the profile object must be created. Note that before you can create the profile object, you must obtain the access and refresh tokens for Hybrid Data Pipeline. Then, the data source can be created. See the following examples for details.
Create the OAuth application object
The following POST request creates an OAuth application object in TenantA (303) for the Google Analytics data store (54). For further details, see OAuth client authorization API.
POST https://MyServer:8443/api/mgmt/oauthapps
{
"name": "TenantA OAuth app",
"dataStore": 54,
"tenantId": 303,
"description": "TenantA OAuth application object",
"clientId": "asdfjasdljfasdkjf",
"clientSecret": "1912308409123890"
"authorizeURI": "https://accounts.google.com/o/oauth2/v2/auth",
"tokenURI": "https://www.googleapis.com/oauth2/v3/token",
"scope": "full_offline_access, test_repo"
}
Create the OAuth profile object
The following POST request creates an OAuth profile object in TenantA OAuth app (17). For further details, see OAuth profiles API.
POST https://MyServer:8443/api/mgmt/oauthprofiles
{
"name": "OAuth_User_1",
"oauthAppId": 17,
"description": "OAuth profile 1",
"accessToken": "111c334445e55",
"refreshToken": "222d88899966fa"
}
Create the data souce
The following POST request creates a Google Analytics data source configured to use OAuth 2.0. For further details, see Data Sources API.
POST https://MyServer:8443/api/mgmt/datasources
{
"name": "OAuth2Datasource_Test",
"dataStore": 54,
"description": "DS for testing oauth profiles",
"options": {
"OAuthProfileId": "31",
"ODataVersion": "4",
"DefaultQueryOptions": "segmentId=-1;",
"ConfigOptions": "defaultView=Progress - No Filters"
}
}