Spring Security Oauth2.0获取token报错invalid_client Bad client credentials

  • A+
所属分类:Spring Security

Spring Security Oauth2.0获取token报错如下:

{
"error": "invalid_client",
"error_description": "Bad client credentials"
}

百度google了很多,基本上都解决不了我的问题。最后在一篇国外的文章的评论里找到了解决方法,特此记录。

ClientDetailsServiceConfigurerconfigure里的.secret("secret")改为.secret(passwordEncoder().encode("secret"))即可。

其中的passwordEncoder函数

public BCryptPasswordEncoder passwordEncoder(){
    return new BCryptPasswordEncoder();
}

Spring Security Oauth2.0获取token报错invalid_client Bad client credentials

ZPY

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: