0

I have tried a demo and its working but when I try in angular it's not perfectly working. and the problem is a function, it's not working.

sign in button

  <div class="g-signin2" data-onsuccess="onSignIn()" data-theme="dark"></div>

added dependency and create clientID

  <meta name="google-signin-scope" content="profile email">
  <meta name="google-signin-client_id" content="******644722-rv6i1sh8437nc82o8egufkui0424k1qg.apps.googleusercontent.com">
  <script src="https://apis.google.com/js/platform.js" async defer></script>

function called

    $scope.onSignIn=function(googleUser){
    var profile = googleUser.getBasicProfile();
    console.log("ID: " + profile.getId());  
    console.log('Full Name: ' + profile.getName());
    console.log('Given Name: ' + profile.getGivenName());
    console.log('Family Name: ' + profile.getFamilyName());
    console.log("Image URL: " + profile.getImageUrl());
    console.log("Email: " + profile.getEmail());
    var id_token = googleUser.getAuthResponse().id_token;
    console.log("ID Token: " + id_token);

  };
4
  • As per your code, the onSignIn function should get parameter. You should pass param when you call in view. Commented Aug 29, 2018 at 5:46
  • @AkashGadhiya I pass parameter but same error and tx for the response Commented Aug 29, 2018 at 5:51
  • What type of problem are you facing? Please add in the description. It will more helpful. Commented Aug 29, 2018 at 5:53
  • when I click to sign in button and after login successfully functions called. but function not working. Commented Aug 29, 2018 at 5:55

1 Answer 1

1

Try this

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

Please refer this link

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.