Spring boot oauth2 研究第N天 action 2

http://localhost:8080/yuyu/oauth/token?grant_type=client_credentials&client_id=trusted-app&client_secret=secret&response_type=code&scope=read&redirect_uri=/resources/user&t=111


感谢上苍,终于解决了

error="invalid_client", error_description="Bad client credentials"

No client with requested id: normal-app

下面是我的搜索之路

1,当然是搜索验证不过

oauth2.0 authorize

没找到,跟源码,找到是这个类,继续搜

AuthorizationEndpoint

这个类是这里产生的

DefaultOAuth2RequestFactory

还是不行,换个思路

oauth2.0 注册 clientId

不行,继续乱搜,其实这里已经接近了,因为就是找到一篇http://blog.csdn.net/buyaore_wo/article/details/48680981,意识到是configure(ClientDetailsServiceConfigurer clients) 这里的问题,http://www.leftso.com/blog/139.html给的源码并没有解决,所以将代码拷贝过来:

@PostConstruct
public void init() {
InMemoryClientDetailsServiceBuilder inMemoryClientDetailsServiceBuilder = new InMemoryClientDetailsServiceBuilder();
// @formatter:off
inMemoryClientDetailsServiceBuilder.

InMemoryClientDetailsService

AuthorizationEndpoint

... 省略

但是还是不起作用,哎,毕竟不熟,继续搜

authorizationserverconfigureradapter 不起作用

WebSecurityConfigurerAdapter AuthorizationServerConfigurerAdapter

authorizationEndpoint

getOAuth2RequestFactory

最后继续跟源码,发现我的低级错误。在

public void configure(ClientDetailsServiceConfigurer clients) throws Exception {

的方法里调用

clients.inMemory().clients(yuyuClientDetailsService);  

并没有设置值进去,修改为

clients.withClientDetails(yuyuClientDetailsService);

搞定,眼泪。。。



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值