5

i'am getting OAuth2AuthorizationException:[authorization_request_not_found]

when trying to replace authorization-grant-type from authorization_code to implicit

 spring:
    security:
      oauth2:
        client:
          registration:
            mobile:
              provider: auth
              client-id: revo
              authorization-grant-type: implicit
              redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}"
              scope: read

the result of this redirect me to /login/oauth2/code/mobile#access_token={++++}&token_type=bearer&state={++++}&expires_in={++++}

but it is Whitelabel Error Page enter image description here can i resolve this Whitelabel Error Page

ashraf revo
  • 767
  • 2
  • 12
  • 24

1 Answers1

2

According to the source code, authorization_request_not_found could be caused by:

  • registration does not exist (when auth server responds to a strange registration)
  • state does not exist (auth server responds with a strange state)

The above should be kept in ClientRegistrationRepository. After checking the client and auth server configuration, the 3rd possibility is that server and client are using the same {baseUrl}, like both localhost or the same ip, even though they are at different ports. Then you can change one of them to use a local configured domain-name (e.g. /etc/host). This is because when both client and server are using the same domain-name, they erase session id the other one just set in cookie.

Tiina
  • 4,285
  • 7
  • 44
  • 73