проблема с гугл логином с php - PullRequest
1 голос
/ 23 сентября 2019

Я делаю логин Google для моего сайта.Я также установил настройки консоли Google в консоли разработчика Google.и используйте этот код для входа в Google.

, но он показывает мне ошибку: 400 redirect_uri_mismatch, хотя я уже установил свой redirect_url

и мой вопрос отличается от Этот вопрос потому что, как мы видим в этом вопросе, 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.

Я не знаю, почему это происходит.

Кто-нибудь может мне помочь в этом.

...