nodeJs:如何禁用Google帐户选择器并仅传递一个邮件ID

时间:2016-02-22 10:45:26

标签: node.js google-api google-fit google-api-nodejs-client

此链接重定向到帐户选择器,但我不想选择任何一个帐户。在nodejs中我需要禁用帐户选择器,是否可以在nodejs中禁用并在URL本身中传递电子邮件,但不能重定向到帐户选择器。 (默认情况下,我想发送任何一个id(example@gmail.com)和url)

此URL用于使用指定用户的访问令牌获取的代码值生成“代码”值。我正在通过系统地获取代码并继续获取访问令牌。每次我生成URL时,它会将我重定向到帐户选择器。而不是我想发送我的电子邮件ID和URL,这样我就不需要手动选择帐户来获取代码并继续进行。

URL: https://accounts.google.com/o/oauth2/auth?access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fplus.me%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fplus.login%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fplus.profiles.read%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffitness.activity.read%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffitness.body.read%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffitness.body.write&response_type=code&client_id=********************************&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fauth%2Fgoogle%2Freturn

1 个答案:

答案 0 :(得分:0)

Try this:
login_hint=emailid

URL + &login_hint=emailid. It will work fine

URL: https://accounts.google.com/o/oauth2/auth?access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fplus.me%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fplus.login%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fplus.profiles.read%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffitness.activity.read%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffitness.body.read%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffitness.body.write&response_type=code&client_id=********************************&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fauth%2Fgoogle%2Freturn