dongxianrang9269 2015-02-09 10:59
浏览 195

Google oauth2在每次登录时显示批准提示

The problem is oauth2 login not works properly using https://github.com/golang/oauth2/ library.

Github works great and not shows approval prompt after once I've approved. But Google oauth2 shows approval prompt on every login.

Below url is golang oauth2 generated auth URL. And I didn't find the problem with it.

https://accounts.google.com/o/oauth2/auth?client_id=my_client_id&redirect_uri=redirect_url&response_type=code&scope=email+profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fplus.login+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fplus.profile.emails.read&state=state

The document(https://developers.google.com/youtube/v3/guides/authentication) said default approval_prompt value is auto.

I've approved the API Testing app properly. And confirmed it from permissions page(https://security.google.com/settings/security/permissions)

And then, https://accounts.google.com/o/oauth2/auth shows approval prompt again. I've double checked approval_prompt is not 'force'.

  • 写回答

1条回答 默认 最新

  • doulu1867 2015-02-12 21:57
    关注

    You can cache the token in a file and check on the start of your application, whether the token is still valid or not. You only need to show the approval prompt if the token is outdated.

    This is the how I did it. The relevant code can be found here.

    评论

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀