OAuth Error
error="invalid_request", error_description="At least one redirect_uri must be registered with the client."
HTML显示如上
控制台报错
16:20:57.013 INFO o.s.s.o.p.e.AuthorizationEndpoint >>> Handling OAuth2 error: error="invalid_request", error_description="At least one redirect_uri must be registered with the client."
16:20:57.013 WARN .m.m.a.ExceptionHandlerExceptionResolver>>> Resolved exception caused by handler execution: error="invalid_request", error_description="At least one redirect_uri must be registered with the client."
解决方法:
在OAuth服务端设置中添加 redirectUris(String...)方法,如下
@Configuration
@EnableAuthorizationServer
public class OAuth2AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
//添加客户端信息
clients.inMemory() // 使用in-memory存储客户端信息
.withClient("client") // client_id
.redirectUris("http://www.baidu.com");
}
}
解决之后的效果:
OAuth Approval
Do you authorize "client" to access your protected resources?
-
scope.app: ○Approve ○Deny
□□□□
PS:之后可能会出一期专门讲SpringBoot+Security+Oauth(JWT)的blog,基于通用Mapper的