0

我正在使用 spring social google 登录来登录我的基于 spring mvc 的 Web 应用程序。

当我尝试使用谷歌登录时,出现以下错误。

The redirect URI in the request, http://localhost:8080/gen/auth/google, does not match the ones authorized for the OAuth client. 

Visit https://console.developers.google.com/apis/credentials/oauthclient/1014044541-l70us8boluo4a.apps.googleusercontent.com?project=1011 to update the authorized redirect URIs.

我在谷歌控制台开发人员中添加了重定向 uri。它与使用 google 签名时传入的内容不同。

我在 google 控制台中将 url 指定为http://localhost:8080/gen/home,但它试图转到http://localhost:8080/gen/auth/google,这在 google 开发控制台中不存在。这里是不匹配的。

那么,我需要如何以及在哪里指定应用程序中的重定向 uri?

4

1 回答 1

0

You should keep in mind the following considerations:

  1. According to the oauth2 protocol your server must be able to receive a query from internet

enter image description here

So you must to provide a reacheable host, not localhost. Try something like dyndns domain (e.g. custom.dyndns.org) and change all the network stuff to allow the incoming traffic to your host specific port

  1. In this link you will find that if you configure the SocialAuthenticationFilterCheck "it will listen to URL’s that start with /auth and route incoming requests to the corresponding social network provider. E.g. a request sent to /auth/facebook will be redirected to the Facebook provider"

  2. Finally you will have a reachable endpoint like http://custom.dyndns.org:8080/gen and then your 'redirect_uri' must be http://custom.dyndns.org:8080/gen/auth/google

于 2016-04-22T06:42:51.540 回答