yudaocode / SpringBoot-Labs

一个涵盖六个专栏:Spring Boot 2.X、Spring Cloud、Spring Cloud Alibaba、Dubbo、分布式消息队列、分布式事务的仓库。希望胖友小手一抖,右上角来个 Star,感恩 1024

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

芋道 Spring Security OAuth2 入门的问题

CristianoYang opened this issue · comments

小白按照教程一步步来,但是密码模式post请求总是返回401,这是为什么呀,头秃。

@OverRide
public void configure(AuthorizationServerSecurityConfigurer oauthServer) throws Exception {
oauthServer.checkTokenAccess("isAuthenticated()");
}
把这个删了就行了。。。

不用删,你用postman请求的时候,没配置客户端基础认证吧
image

要带上客户端认证的哈。

后面,我把模拟请求改成 IDEA Rest Client 插件,方便大家理解~

要带上客户端认证的哈。
访问ExampleController
带上客户端认证,在resource,Authorization就带不了Bearer ,被覆盖了,报错401,去掉客户端认证,后台直接报错,
image

同样的问题