title: Spring Security 5 OAuth2 Client does work with AuthorizationServer based on legacy Spring Seucrity OAuth
body: <p>Currently Spring Security 5.0.x only includes new OAuth2 client, OAuth authorization server and resource server are planned in the further release.</p>
  
  <p>I tried to use the legacy Spring Security OAuth 2.3 to provide authorization server. </p>
  
  <p>I found there is an existed project here for this purpose. </p>
  
  <p><a href="https://github.com/spring-tips/spring-security-5-oauth-client" rel="nofollow noreferrer">https://github.com/spring-tips/spring-security-5-oauth-client</a></p>
  
  <p>But I tried to upgrade <code>auth-service</code> to Spring boot 2.0, and use the latest <code>spring-security-oauth2-autoconfigure</code> to handle auto configuration in Spring Boot 2.0.</p>
  
  <p>When I ran these two applications in my local system, and got the error like the following when it return the client application.</p>
  
  <pre><code>Your login attempt was not successful, try again.
  
  Reason: [authorization_request_not_found]
  Login with OAuth 2.0
  Login Client
  </code></pre>
  
  <p>I have already forked this project and committed my changes to:</p>
  
  <p><a href="https://github.com/hantsy/spring-security-5-oauth-client" rel="nofollow noreferrer">https://github.com/hantsy/spring-security-5-oauth-client</a></p>
  
  <p>And also opened an issue on the issues of the upstream project.</p>
  
  <p><a href="https://github.com/spring-tips/spring-security-5-oauth-client/issues/5" rel="nofollow noreferrer">https://github.com/spring-tips/spring-security-5-oauth-client/issues/5</a></p>
  
  <p><strong>Update</strong>: After I researched the <a href="https://github.com/spring-guides/tut-spring-security-and-angular-js" rel="nofollow noreferrer">https://github.com/spring-guides/tut-spring-security-and-angular-js</a>, the cookie will be problematic if the auth server and client(sso) used the same host and context path. I added <strong>/uaa</strong> as context path in auth server, it worked.</p>