用PHP登录谷歌的问题

时间:2019-09-23 04:43:42

标签: php google-console-developer

我正在为我的网站进行google登录。我还在Google开发人员控制台中设置了Google控制台设置。并将此代码用于Google登录。

但它显示了一个错误:400 redirect_uri_mismatch,而我已经设置了redirect_url

我的问题与This question不同,因为正如我们在该问题中看到的那样,未声明redirect_uri,但我已经声明了它。

我在下面显示我的代码

<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="*********CLIENT-ID********">
<script type="text/javascript">
    function onSignIn(googleUser) {
      var profile = googleUser.getBasicProfile();
      console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
      console.log('Name: ' + profile.getName());
      console.log('Image URL: ' + profile.getImageUrl());
      console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
    }
</script>
</head>
<body>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
<a href="#" onclick="signOut();" style="display: none;">Sign out</a>
<script>
  function signOut() {
    var auth2 = gapi.auth2.getAuthInstance();
    auth2.signOut().then(function () {
      console.log('User signed out.');
    });
  }
</script>

当我单击Google注册按钮时,它会重定向到URL

  

https://accounts.google.com/o/oauth2/auth?redirect_uri=storagerelay%3A%2F%2Fhttps%abc.com%3Fid%3Dauth535373&response_type=permission%20id_token&scope=email%20profile%20openid&openid.realm=&client_id= *******&ss_domain = https%3A%2F%2Fabc.com&fetch_basic_profile = true&gsiwebsdk = 2

并显示错误:redirect_uri_mismatch。

我不知道为什么会这样。

有人可以帮我吗?

0 个答案:

没有答案