12

我可以单独使用两者prompt=consentprompt=select_account但谷歌似乎不允许我将它们结合起来。我尝试了Force google accountprompt=consent+select_account chooser答案中建议的方法,但失败并出现错误:“无效提示:同意 + select_account”。

文档(https://developers.google.com/accounts/docs/OAuth2Login)说“以空格分隔的列表”,所以我尝试consent select_account了但失败了:“在此服务器上找不到请求的 URL。”

我也尝试过结合prompt=select_accountand approval_prompt=force,但谷歌也不喜欢这样。

其他人有幸将同意屏幕和帐户选择器结合起来吗?

更新:

这是我创建用于从 gmail 获取联系人的 URL 的 JavaScript 方法

$scope.importGmailContacts = function() {
    provider = 'gmail';
    $scope.importing_from_gmail = true;
    window.open(protocol + "://" + host + ":" + port + "/contacts/gmail", "_blank",
     "toolbar=yes, scrollbars=yes, resizable=yes, top=0, left=0, width=600, height=600, prompt='select_account+consent', approval_prompt=force");
}

我已经尝试过集体和个人的设置promptapproval_prompt但它似乎不起作用。参考这个问题

4

3 回答 3

4

您需要添加access_type=online&prompt=select_account+consent::

private static final String AUTHORIZE_URL 
    = "https://accounts.google.com/o/oauth2/auth?"
      + "response_type=code&access_type=online&prompt=select_account+consent"
      + "&client_id=xxx&redirect_uri=xxx";

private static final String SCOPED_AUTHORIZE_URL = AUTHORIZE_URL + "&scope=xxx";

..

于 2016-06-28T06:22:10.607 回答
1

我刚试过这个,它在空格分隔时确实有效:

options[:prompt] = 'select_account 同意'

于 2015-02-13T21:46:13.453 回答
-1

https://accounts.google.com/o/oauth2/auth?client_id=XXXX&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=https://www.googleapis.com/auth/analytics.readonly&response_type=code&prompt= select_account+consent&approval_prompt=force

导致错误

  1. 那是一个错误。

错误:invalid_request

冲突参数:approval_prompt 和 prompt

Prompt 和approval_prompt 参数不能一起使用。

提示 可选。

向用户显示的以空格分隔、区分大小写的提示列表。如果您不指定此参数,则只会在您的应用第一次请求访问时提示用户。可能的值为:
none 不显示任何身份验证或同意屏幕。不得与其他值一起指定。
同意提示用户同意。
select_account 提示用户选择一个帐户。

如果记忆服务approval_prompt 是较旧的方式,谷歌在2012 年的某个时候添加了Prompt。我实际上无法再找到关于approval_prompt 的任何文档,但如果记忆服务它与执行prompt=consent 相同,它只是再次请求访问。

于 2017-05-11T10:55:00.873 回答