node.js - Node Js : how to disable google account chooser and pass only one mail id

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

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

此 URL 用于使用将获取指定用户的访问 token 的代码值来生成“代码”值。我正在系统地获取代码并继续获取访问 token 。每次我生成 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

最佳答案

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

关于node.js - Node Js : how to disable google account chooser and pass only one mail id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35551581/

相关文章:

android - Google Fit 在 Android 中获取一小时内的运动数据

node.js - Mongodb NodeJS驱动程序skip()不起作用

php - 谷歌地图地理定位不请求许可

api - 类型为 : multipart/form-data in google plus api oauth2 的不受支持的内容

java - 无法使用智能手环 2 从 Google Fit API 获取心率数据

android - 如何将心率数据从智能手环传输到 Android 应用程序

javascript - Knex 数据未插入 postgres

node.js - LoopBack 安装失败,错误代码 "ECONNRESET"

css - 如何在 React 应用程序中加载 css?

javascript - 如何从应用程序脚本中使用 googleapis