Google Sign in integration failure after load

26 Views Asked by At
<div id="g_id_onload"
data-auto_prompt="true"
data-cancel_on_tap_outside="false"
 data-client_id="138405127480-26q0p0q9uelfhopcl5lbuaf3746qoiit.apps.googleusercontent.com"
 data-context="signin"
 data-callback="onSignIn"
 data-auto_select="true"
 data-login_uri="http://localhost:80/Qform.html"
 data-itp_support="true">



TokenClient.requestAccessToken()
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.
  let fullName = profile.getName();
  let email = profile.getEmail();
  let imageUrl = profile.getImageUrl();
  console.log('Logged in as: ' + googleUser.getBasicProfile().getName());
  alert("loggedin",fullName)
  }
  function onSignInFailure(error) {
    // Handle sign-in errors
    Error("error")
    console.error('Sign-in failure:', error);
  }
  function renderButton() {
    gapi.signin2.render('g-signin13', {
      'scope': 'profile email https://www.googleapis.com/auth/youtube.readonly https://www.googleapis.com/auth/analytics.manage.users https://www.googleapis.com/auth/userinfo.profile',
      'width': 1523,
      'height': 100,
      'longtitle': true,
      'theme': 'light',
      'onsuccess': onSignIn,
      'data-login_uri':'http://localhost/Qform.html',
      'onfailure': onSignInFailure

    });
  }
</script>

This is my code I am having a problem. When click on the button and choose an account, it goes to scope screen which is absolutely perfect when I grant access it loads and just abruptly stops. It's a web application.

My mistake and Soultion to my problem

0

There are 0 best solutions below