google-searchconsole icon indicating copy to clipboard operation
google-searchconsole copied to clipboard

Service Accounts

Open andyoneal opened this issue 7 years ago • 1 comments

I got this working using a service account. It requires you to delegate domain-wide authority to the service account, which requires you to have G Suite. The G Suite admin will need to add the Client ID of the service account with the scope "https://www.googleapis.com/auth/webmasters.readonly".

After the service account is setup correctly, the code mostly worked as-is. I only added the scope and the user the service account is impersonating to the auth process. Compared to the existing quickstart example, I only changed line 2 to account = searchconsole.authenticate(service_account='client_secrets.json', user_email='[email protected]') and the experience is identical, obviously excluding the interactive parts.

andyoneal avatar Dec 05 '18 22:12 andyoneal

Hi @andyoneal - sorry for being so slow getting back to you. Really appreciate the contribution!

Is this functionality different to the service account feature implemented in this service-accounts branch?

There's some discussion of service accounts and my reluctance to merge without a service account to test with here.

joshcarty avatar Jun 16 '19 13:06 joshcarty