ZPY博客

spring security oauth2 0 报错at least one redirect_uri must be registered with the client

---
title: Spring Security Oauth2.0 报错At least one redirect_uri must be registered with the client
date: 2019-01-07 16:59:55
categories: Spring Security
tags:
- spring
- redirect_uri
- security
- oauth2.0
- registered
- AuthorizationServerConfigurerAdapter
---

Spring Security Oauth2.0 报错OAuth Error
error="invalid_request", error_description="At least one redirect_uri must be registered with the client."

解决方法:在认证Server端里的AuthorizationServerConfigurerAdapter继承类的configure里加上redirectUris("http://localhost:8082/ui/login")即可。

@Override
    public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
        clients.inMemory()
                .withClient("SampleClientId")
                .secret("secret")
                .authorizedGrantTypes("authorization_code")
                .scopes("user_info")
                .autoApprove(true)
                .redirectUris("http://localhost:8082/ui/login");
    }