Гугл залогинится если член группы? - PullRequest
0 голосов
/ 20 сентября 2019

В настоящее время тестируя вход в Google для своего веб-приложения, я могу правильно входить и выходить из него.

Моему веб-приложению необходимо знать, входит ли пользователь в группу, чтобы можно было различать, какой уровень доступа применять

Есть ли простой способ узнать, входит ли пользователь Google в группу при входе в систему?

Это мой текущий код тестирования

<html>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="776368181437-3b745j2obq85q0sqm8i2ehjtr80u32gt.apps.googleusercontent.com">

<div class="g-signin2" data-onsuccess="onSignIn"></div>

<meta charset="utf-8" />
<div id="profileinfo"></div>
<!-- below script gets called from above sign in button -->
<script>
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.
  document.getElementById('profileinfo').innerHTML = profile.getName() + "<br>" + "<a href='mailto:" + profile.getEmail() + "'>" + profile.getEmail() + "</a>" + "<br>" + "<img src='" + profile.getImageUrl() + "'/>";
}
</script>

<a href="#" class="g-signout" onclick="signOut();">Sign out</a>

<!-- below script gets called from above sign in button -->
<script>
  function signOut() {
    var auth2 = gapi.auth2.getAuthInstance();
    auth2.signOut().then(function () {
       if(!gapi.auth2){
    gapi.load('auth2', function() {
        gapi.auth2.init();
    });
 }
      auth2.disconnect();
      console.log('User signed out.');
          });
  }

</script>

Впсевдокод мне почти нужен "Если пользователь успешно авторизовался и является членом" Разрешенной группы ", чем перенаправить на хорошую страницу, иначе перенаправить на плохую страницу"

Спасибо за любые предложения

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...