Using the OAuth profiles API to create an OAuth profile
If a user intends to use the Data Sources API to create data sources on a Google Analytics data store, the user must first create an OAuth profile with the OAuth profiles API. The OAuth profiles API permits Hybrid Data Pipeline access to Google Analytics through the creation of an OAuth profile object. The OAuth profile object holds OAuth access and refresh tokens that are initially supplied by Google. These tokens enable Hybrid Data Pipeline to access Google Analytics on behalf of the user. Before a user can create an OAuth profile, he or she must obtain these tokens from Google before executing the POST to create the OAuth profile.
OAuth profiles are created or selected for data sources, and a single OAuth profile can be used for multiple data sources on a Google Analytics data store. Since OAuth profiles are associated with data sources, a user must have the CreateDataSource (1) permission to create a profile.
Once the user has obtained the required access and refresh tokens from Google, he or she may proceed with a POST operation to create an OAuth profile.
POST operation
The POST operation to create an OAuth profile will have the following syntax.
POST https://<myserver>:<port>/api/mgmt/oauthprofiles
Payload definition
The payload used to create the OAuth profile can be defined as follows.