0

I read the Google Oauth2 documentation and it seems that I can send a login_hint parameter as part of the authorization request, similar to specifying access_type.

I am using an offline access_type for a web server application (Rails application).

I tried setting the parameter on the Client's authorization object as well as passing it as an option when initializing the client but it never auto-fills the login box nor is sent as a query parameter.

All I'm trying to do is, if the user is logged in to Gmail already with a different account then they should be prompted to login / select a different account (which is specified in the login_hint).

4

1 回答 1

0

我通过使用可用login_hint的哈希设置参数来使其工作。additional_parametersSignet::OAuth2::Client

基本上,执行以下操作:

client = Google::APIClient.new(application_name: 'test application', application_version: '0.0.1')
client.authorization.additional_parameters[:login_hint] = 'some_address@gmail.com'

additional_parameters如果您收到有关未定义的错误,请确保您使用的是最新版本的signetgem 或使用 master 分支中的最新版本。

于 2014-02-22T20:53:36.623 回答