首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在使用授权代码授权时,如何使用SpringSecurityOAuth2-Client获取和维护oauth2令牌

在使用授权代码授权时,如何使用SpringSecurityOAuth2-Client获取和维护oauth2令牌
EN

Stack Overflow用户
提问于 2022-10-18 11:32:37
回答 1查看 34关注 0票数 1
代码语言:javascript
复制
How can I get the token to the front end angular application after successful redirection to the index.html page happens like
1. I have used 
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-oauth2-client</artifactId>
        </dependency>
in my pom.xml
2. then I have added required properties in my application.properties file
3. I built the angular files and placed them under resources/static folder

现在重定向到auth服务器并回调到应用程序是成功的,但是如何获取oauth2令牌并将其存储在角应用程序中,这将对进一步的调用非常有用。

EN

回答 1

Stack Overflow用户

发布于 2022-10-18 18:35:11

如果您有一个角应用程序,那么它就是客户端。它应该使用角钢客户端或类似的:

  • 登录用户
  • 句柄重定向到和从authorization-server
  • 交换授权.访问代码.令牌
  • 访问-令牌刷新
  • 向发送到已配置的安全路由的请求中添加带有访问令牌的授权头。

Spring应用程序是resource-servers.它应该依赖于spring-boot-starter-oauth2-resource-server,而不是spring-boot-starter-oauth2-client。有关配置spring资源服务器的更多详细信息,请参阅Spring或查看那些教程

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74110261

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档