首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >绕过非管理用户的作用域同意屏幕

绕过非管理用户的作用域同意屏幕
EN

Stack Overflow用户
提问于 2014-05-25 18:22:37
回答 2查看 563关注 0票数 1

Google应用市场#5最佳实践表明,用户在管理员安装应用程序后不应该看到同意屏幕。我一直在尝试让它在Rails应用程序上工作,使用devise和omniauth Google-OAuth2进行身份验证。我已经设置了测试域使用管理帐户的应用程序。但是非管理员用户总是看到同意屏幕。知道如何避免吗?https://github.com/zquestz/omniauth-google-oauth2有一些帮助;但是设置其中指定的任何选项都没有帮助。

我的配置如下:

代码语言:javascript
复制
config.omniauth :google_oauth2, "code", "code", { access_type: "online", approval_prompt: "none", include_granted_scopes: "true", prompt: "select_account" }

指定“电子邮件、概要文件、日历、https://www.google.com/m8/feeds/”这样的作用域会产生以下错误:

代码语言:javascript
复制
Error: invalid_scope

Some requested scopes were invalid. {valid=[https://www.googleapis.com/auth/calendar, https://www.google.com/m8/feeds/], invalid=[https://www.googleapis.com/auth/profile, https://www.googleapis.com/auth/email], noncanonical=[https://www.google.com/m8/feeds/(https://www.googleapis.com/auth/contacts)]}
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-06-04 16:52:34

添加

https://www.googleapis.com/auth/plus.me

"Google“中的作用域列表解决了这个问题。当域管理员安装应用程序时,其余的域用户将看不到同意屏幕。

即使是我的杂耍配置现在也简化了。如下所示:

代码语言:javascript
复制
config.omniauth :google_oauth2, "XXX.apps.googleusercontent.com", "YYY", { access_type: "online", approval_prompt: "none", include_granted_scopes: "true" }
票数 1
EN

Stack Overflow用户

发布于 2014-05-27 16:30:47

关于invalid_scope错误,我认为您需要在配置文件和电子邮件中使用以下范围

https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile

fyi使用https://developers.google.com/oauthplayground/查找其他Google的有效作用域

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23858524

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档