Search code examples
google-admin-sdkgoogle-alertsgoogle-alert-center-api

Alert Center API Scope issue


According to the documentation: https://developers.google.com/admin-sdk/alertcenter/reference/rest/v1beta1/TopLevel/getSettings#authorization-scopes

And Also the discovery Documents: https://alertcenter.googleapis.com/$discovery/rest?version=v1beta1

The scope for "Alert Center API" is https://www.googleapis.com/auth/apps.alerts

However, when I use this scope, I get the error message:

Authorization Error
Error 400: invalid_scope
Some requested scopes cannot be shown: [https://www.googleapis.com/auth/apps.alerts]

Did the scope change and the documentation is outdated? Any other options to access this API?


Solution

  • This response is happening because you are not using the scope with a service account. As described by this piece of documentation:

    Your project must use a service account when accessing the API.

    Therefore, if you access this API with a service account you will be able to interface it correctly, otherwise, you won't. More about service account authorization here.

    Also, note that the scope is in the list under G Suite Alert Center API v1beta1.