SpringBoot-Labs icon indicating copy to clipboard operation
SpringBoot-Labs copied to clipboard

芋道 Spring Security OAuth2 入门的问题

Open CristianoYang opened this issue 4 years ago • 5 comments

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

CristianoYang avatar Aug 09 '20 11:08 CristianoYang

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

CristianoYang avatar Aug 09 '20 12:08 CristianoYang

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

FateFrank avatar Aug 10 '20 07:08 FateFrank

要带上客户端认证的哈。

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

YunaiV avatar Aug 10 '20 08:08 YunaiV

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

liubinylx avatar Sep 08 '20 10:09 liubinylx

同样的问题

aq666888 avatar Oct 25 '22 02:10 aq666888