Angularjs 带Oauth2的弹簧靴
我在Spring Boot中开发了一个GoogleOAuth2登录,它工作正常。我想在点击按钮后重定向到某个特定的URL。我正在谷歌Oauth2上使用Angularjs 带Oauth2的弹簧靴,angularjs,spring,oauth-2.0,google-oauth,spring-security-oauth2,Angularjs,Spring,Oauth 2.0,Google Oauth,Spring Security Oauth2,我在Spring Boot中开发了一个GoogleOAuth2登录,它工作正常。我想在点击按钮后重定向到某个特定的URL。我正在谷歌Oauth2上使用应用程序.yml 我想在身份验证后重定向到特定的URL 以下是我用于Google OAuth2的代码: Application.yml 安全性: oauth2: 客户: 客户ID: 客户机密: accessTokenUri:https://accounts.google.com/o/oauth2/token userAuthorizationUri
应用程序.yml
我想在身份验证后重定向到特定的URL
以下是我用于Google OAuth2的代码:
Application.yml
安全性:
oauth2:
客户:
客户ID:
客户机密:
accessTokenUri:https://accounts.google.com/o/oauth2/token
userAuthorizationUri:https://accounts.google.com/o/oauth2/v2/auth
clientAuthenticationScheme:表单
范围:
-openid
-电子邮件
-侧面图
资源:
用户信息URI:https://www.googleapis.com/oauth2/v3/userinfo
首选令牌信息:true
代码有什么问题?此代码没有问题。我想将其重定向到其他页面您想在登录过程后更改重定向到的url吗?我想制作一个Html,在其中,当我登录时,它将执行Oauth自动验证并重定向到某个特定url。在此代码中,我使用Google API,但我的实际要求是,Oauth验证的流程应为:用户请求一些url->如果您没有授权,服务器将重定向到登录页面->原始url已提供。也许您需要修改第一个访问:例如用户请求/
,然后重定向到/home.html
。见此:
security:
oauth2:
client:
clientId: <Google Client Id>
clientSecret: <Google Secret Id>
accessTokenUri: https://accounts.google.com/o/oauth2/token
userAuthorizationUri: https://accounts.google.com/o/oauth2/v2/auth
clientAuthenticationScheme: form
scope:
- openid
- email
- profile
resource:
userInfoUri: https://www.googleapis.com/oauth2/v3/userinfo
preferTokenInfo: true