apioauthgoogle-search-consolegoogle-api-ruby-clientgoogle-site-verification-api

Google Site Verification via API Key


We have tried various things to get the Google Site Verification API to work, including: How can I authorize with OAuth 2.0 for google's predictive API in Ruby?

By calling: https://developers.google.com/site-verification/v1/webResource/list using the service account we always get an empty response: {}

When trying the same thing via the web console we get all the websites. We have like 30 websites.

I also had a look at this stackoverflow: Unable to access Google Sites via API, but can via Oauth Playground. Why?, without success.

OAuth 2.0 is not an option for us, as we have a server application.


Solution

  • When using the service account, it will only list the sites that are owned by that service account. If you want to get the sites of a specific user, you must impersonate that user.

    I haven't implemented it yet, but apparently you must go to http://www.google.com/a/{your-domain}/ManageOauthClients logged as the user that owns the sites and authorize the client ID of the service account you'll use to access the API, with the appropriate scopes.

    This video explains it using Google Drive, but the authentication process is the same.

    I'm not sure if this is available for Gmail users.