当使用oauth2-client作为隐式授予类型时,解决[authorization_request_not_found]问题。

问题描述 投票:3回答:1

我得到OAuth2AuthorizationException:[authorization_request_not_found]。

当试图将授权-授权类型从authorization_code替换为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

结果将我重定向到loginoauth2codemobile#access_token={++++}&token_type=bearer&state={++++}&expires_in={++++}。

但它是白标错误页面enter image description here我可以解决这个白标错误页面吗?

spring spring-security spring-oauth2
1个回答
0
投票

根据源码。authorization_request_not_found 可能是由以下原因引起的

  • 注册不存在(当auth服务器响应一个奇怪的注册)。
  • 状态不存在(auth服务器以一个奇怪的状态响应)

上述情况应保持在 ClientRegistrationRepository. 在检查了客户端和auth服务器的配置后,第三种可能是服务器和客户端使用了相同的 {baseUrl}例如,尽管它们在不同的端口,但都是localhost或同一个ip。那么你可以把其中一个改成使用本地配置的域名(例如etchost)。这是因为当客户端和服务器都使用同一个域名时,他们会擦掉另一个在cookie中刚刚设置的session id。

© www.soinside.com 2019 - 2024. All rights reserved.