简体   繁体   English

Google 登录:令牌已过期

[英]Google Sign-in: Token Expired

I am using google sign-in to allow users to sign-up for my website.我正在使用谷歌登录来允许用户注册我的网站。 The issue I'm having is that my sign-up process is quite lengthy (could take more than 1 hour), and I don't send any information to my backend before the end of the sign-up.我遇到的问题是我的注册过程很长(可能需要超过 1 小时),并且在注册结束之前我没有向我的后端发送任何信息。 However, my the google token expires after 1 hour.但是,我的 google 令牌会在 1 小时后过期。 I want to avoid the client having to send more than 1 request to google for authentication.我想避免客户端必须向 google 发送超过 1 个请求进行身份验证。

Is there any way to exchange this token for a long-lived token on the backend?有没有办法在后端用这个令牌交换一个长期存在的令牌? I know facebook oauth offers that functionality.我知道 facebook oauth 提供了该功能。

Is there any way to exchange this token for a long-lived token on the backend?有没有办法在后端用这个令牌交换一个长期存在的令牌?

No, using the referenced article.不,使用引用的文章。

Yes, if you also request the Refresh Token during authorization with Google.是的,如果您在向 Google 授权期间还请求刷新令牌。 This requires that the OAuth Flow runs on your webserver.这要求 OAuth Flow 在您的网络服务器上运行。

The Refresh Token can create (request) an Access Token when required.刷新令牌可以在需要时创建(请求)访问令牌。 Therefore you don't care about how long your backend takes.因此,您不关心后端需要多长时间。

You cannot do the reverse: request a Refresh Token from an Access Token.您不能做相反的事情:从访问令牌请求刷新令牌。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM