Google应用市场#5最佳实践表明,用户在管理员安装应用程序后不应该看到同意屏幕。我一直在尝试让它在Rails应用程序上工作,使用devise和omniauth Google-OAuth2进行身份验证。我已经设置了测试域使用管理帐户的应用程序。但是非管理员用户总是看到同意屏幕。知道如何避免吗?https://github.com/zquestz/omniauth-google-oauth2有一些帮助;但是设置其中指定的任何选项都没有帮助。
我的配置如下:
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/”这样的作用域会产生以下错误:
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)]}发布于 2014-06-04 16:52:34
添加
"Google“中的作用域列表解决了这个问题。当域管理员安装应用程序时,其余的域用户将看不到同意屏幕。
即使是我的杂耍配置现在也简化了。如下所示:
config.omniauth :google_oauth2, "XXX.apps.googleusercontent.com", "YYY", { access_type: "online", approval_prompt: "none", include_granted_scopes: "true" }发布于 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的有效作用域
https://stackoverflow.com/questions/23858524
复制相似问题