2

My asp.net mvc application access Google Analytics services for which Google requests permission.

Is there a way we can bypass or automatically authorized it without showing the dialog box to user? Problem is I dont want the account details to give to each customers and they know the credentials which will be used by admin as well to monitor all information.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
Hammad Nasir
  • 119
  • 1
  • 11

1 Answers1

2

Your question is a little unclear. It sounds like you are trying to share access to your Google Analytics account with other people. In the event this is the case then you should look into using a Service account instead of Oauth2 for authentication.

Service accounts are dummy users used for pre-authenticating access to private data. You take the service account email address and add it as a user on the Google Analytics website for the Account in question. Note: the user must be added at the ACCOUNT level. This is how you preauthorize the service account it now has access to extract data from that account.

Service accounts will lonely work if this is an account you the developer own I wouldn't recommend creating as service account and handing it out to your customers requesting access. In that case you should use Oauth2 they authenticate your application and you use the refresh token to get access the next time.

I have a short blog post on how service accounts work Google Developers console service accounts

I also have some code on how to authenticate with a service account Google Analytics API Authentication with C#

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
  • i am using service account, but still when url is access , it ask to login to gmail account ? i suppose it should not ask the user to login for gmail account because it already has the user in it inside certificate – Hammad Nasir May 19 '16 at 12:19
  • Then you aren't using a service account it doesn't pop up resting access – Linda Lawton - DaImTo May 19 '16 at 12:32