I can access the list of websites with the google API for webmasters using an access token granted via web service request and now I'd like to do it via a server to server request.
After giving the permission to a server account to access the list I cannot use setAssertionCredentials
properly using the following scope:
'https://www.googleapis.com/auth/webmasters'
Case 1
when impersonating the user account:
$cred->sub = 'user.account@gmail.com';
the PHP client returns
'Error refreshing the OAuth2 token, message: '{ "error" : "unauthorized_client", "error_description" : "Unauthorized client or scope in request." }
Case 2
Without impersonating the user account the PHP client get an empty array
Question
How to impersonate a user using a server to server Google for webmasters API request?
Related contents without answer