使用 Google Access 登录被阻止:此应用程序的请求无效

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

我正在使用 Spring Boot 版本 2.5.5 ,Java/JDK 11。我的

application.yml

spring:
    datasource:
        url: jdbc:mysql://localhost:3306/spring_social?useSSL=false&serverTimezone=UTC&useLegacyDatetimeCode=false
        username: root
        password: 12345678

    jpa:
        show-sql: true
        hibernate:
            ddl-auto: create
            naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
        properties:
            hibernate:
                dialect: org.hibernate.dialect.MySQL5InnoDBDialect
    security:
      oauth2:
        client:
          registration:
            google:
              clientId: 5014057553-8gm9um6vnli3cle5rgigcdjpdrid14m9.apps.googleusercontent.com
              clientSecret: tWZKVLxaD_ARWsriiiUFYoIk
              redirectUri: "{baseUrl}/oauth2/callback/{registrationId}"
              scope:
                - email
                - profile
            facebook:
              clientId: 1607503586442097
              clientSecret: 6d20edba658764a009aaded61cab234a
              redirectUri: "{baseUrl}/oauth2/callback/{registrationId}"
              scope:
                - email
                - public_profile
            github:
              clientId: d3e47fc2ddd966fa4352
              clientSecret: 3bc0f6b8332f93076354c2a5bada2f5a05aea60d
              redirectUri: "{baseUrl}/oauth2/callback/{registrationId}"
              scope:
                - user:email
                - read:user
          provider:
            facebook:
              authorizationUri: https://www.facebook.com/v17.0/dialog/oauth
              tokenUri: https://graph.facebook.com/v17.0/oauth/access_token
              userInfoUri: https://graph.facebook.com/v17.0/me?fields=id,first_name,middle_name,last_name,name,email,verified,picture.width(250).height(250)
app:
  auth:
    tokenSecret: 04ca023b39512e46d0c2cf4b48d5aac61d34302994c87ed4eff225dcf3b0a218739f3897051a057f9b846a69ea2927a587044164b7bae5e1306219d50b588cb1
    tokenExpirationMsec: 864000000
  cors:
    allowedOrigins: http://localhost:3000,http://localhost:8080
  oauth2:
    # After successfully authenticating with the OAuth2 Provider,
    # we'll be generating an auth token for the user and sending the token to the
    # redirectUri mentioned by the client in the /oauth2/authorize request.
    # We're not using cookies because they won't work well in mobile clients.
    authorizedRedirectUris:
      - http://localhost:3000/oauth2/redirect
      - myandroidapp://oauth2/redirect
      - myiosapp://oauth2/redirect

我发现错误

Sign in with Google
Access blocked: This app’s request is invalid

[email protected]
You can’t sign in because this app sent an invalid request. You can try again later, or contact the developer about this issue. Learn more about this error
If you are a developer of this app, see error details.
Error 400: redirect_uri_mismatch

如何解决?

java spring spring-boot google-signin
1个回答
0
投票

将授权重定向 URI 设置为

http://localhost:3000

将正确的 URI 设置为您的应用程序 URL。

这是我的 Google 应用程序配置

如何解决?

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