Google APIの呼び出し時に 'The service searchconsole has thrown an exception. HttpStatusCode is Unauthorized. API keys are not supported by this API. Expected OAuth2 access token or other authentication credentials that assert a principal.' エラーが発生する
Google Search Console APIの呼び出し時に 'The service searchconsole has thrown an exception. HttpStatusCode is Unauthorized. API keys are not supported by this API. Expected OAuth2 access token or other authentication credentials that assert a principal.' エラーが発生する現象について紹介します。
現象
Google Search Console APIの呼び出し時に次のエラーが発生します。
エラーメッセージ
Google.GoogleApiException: 'The service searchconsole has thrown an exception. HttpStatusCode is Unauthorized. API keys are not supported by this API. Expected OAuth2 access token or other authentication credentials that assert a principal. See https://cloud.google.com/docs/authentication'