我配置了 Google GMAIL API oAuth 应用程序。 当我在 Google Cloud 控制台中进行设置时,我授予它访问所有 gmail 范围的权限。
但是,当我启动 oAuth 同意屏幕时,我仅看到一个选择只读范围的选项。
我读到,如果您想在生产中访问这些范围,则需要验证应用程序,但这是一个发布状态为“测试”而不是生产的应用程序。 如何让
.../auth/gmail.labels
和
.../auth/gmail.modify
等范围在此 oAuth 屏幕中显示为选择,以便允许我的应用程序在消息上设置标签?https://accounts.google.com/o/oauth2/v2/auth/oauthchooseaccount?
response_type=code&
client_id=abc123
&redirect_uri=http%3A%2F%2Flocalhost%3A8082
prompt=consent&
scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.modify%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.labels&
access_type=offline&
service=lso&
o2v=2&
ddm=0&
flowName=GeneralOAuthFlow
scope
参数用于指示您希望同意屏幕向用户请求哪些权限。 这是来自 Google API 文档的以空格分隔的范围列表。 然后,用户需要明确选中他们为应用程序提供的范围的框。
如果您使用为您生成此 URL 的客户端库,它们可能为您提供配置这些范围的能力。只有您的图书馆文档才能确定。