简体   繁体   English

如何在Spring启动项目中制作谷歌自动登录功能?

[英]How to make google auto login functionality in Spring boot project?

I have applied google login functionality in my spring project. 我在我的春季项目中应用了谷歌登录功能。 which functions like-- a user login in with google account the details of user saved into database. 其功能类似于 - 用户使用谷歌帐户登录用户保存到数据库的详细信息。 But, I have a requirement to auto login google account user who previously logged in with the account. 但是,我要求自动登录以前使用该帐户登录的Google帐户用户。 but I don't know how to do that. 但我不知道该怎么做。 One way to do that (what I think) is to save cookie, but after that how a user logged in using that cookie. 一种方法(我认为)是保存cookie,但在那之后用户如何使用该cookie登录。

I am using Spring Security Oauth2 got google sign in. After searching I got, openid is used to autologin. 我正在使用Spring Security Oauth2获得谷歌登录。搜索后我得到了,openid用于自动登录。 But I don't know how to apply and implement it. 但我不知道如何应用和实施它。

Look into refresh tokens. 查看刷新令牌。 Once the user been inactive for 2 hours (as by default), his token expires. 一旦用户处于非活动状态2小时(默认情况下),他的令牌就会过期。 He can obtain a new one if he has a refresh token, which you can store on your side when you authorize that user. 如果他有刷新令牌,他可以获得一个新签名,当您授权该用户时,您可以将其存储在您身边。

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

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