Parameter | Description |
---|---|
Client Id | From Google Developer console identifies your project or application |
secret | From Google Developer console identifies your project or application |
redirect_uri | From Google Developer location where the authentication should be returned to. In the case of Native applications urn:ietf:wg:oauth:2.0:oob can be used to denote localhost |
In order to access any Google API you need to identify yourself as a developer and identify your project. We do that by creating a new project on Google Developers console.
When you create your project you if you want to access the Google Analytics APIs you must enable the APIs you intend to access.
Now you must decide how you would like to access the data.
With Google Data there are two types of Data Public and Private.
If you are only accessing public data then all you need do is create a public API key and you will be able to access the API in question. If you are going to be accessing private user data then you will need to create either Oauth2 credentials or service account credentials.
Authorization Oauth2
To access private user data we must have permission of the owner of the data to access it. Oauth2 allows us to request that access from a user.
You have probably seen before Oauth2 before.
The Application "Google Analytics Windows" is requesting access to view the users "Google Analytics Data"
Scope We need to tell the user what we intend to do the Google analytics API has two scopes that you can use.
It is best to only request the scopes that you need. If you will only be reading a users data then you only need to request the readonly scope.
Authorization service accounts
Service accounts are different in that they are pre-approved. If you create service account credentials you as the developer can take the service account email and add it as a user on your Google Analytics account At the account level this will grant the service account access to the data. You wont need to pop up the authentication window and request access. The service account will have access to the data for as long as it is a user on the Google Analytics account.
Conclusion
Authentication is needed to access most of the data exposed by the Google Analytics API.
You can not use client login / login and password to access any Google API as of May 2015. You must use Open authentication.
**