I am trying to implement google auth in angualjs. But I researched and got the code in javascript.
the code:
<html lang="en">
<head>
<meta name="google-signin-scope" content="profile email">
<meta name="google-signin-client_id" content="148699057185-ug1ge86g4dn4uffffekth3rb7382cl2333323238fau.apps.googleusercontent.com">
<script src="https://apis.google.com/js/platform.js" async defer></script>
</head>
<body>
<div class="g-signin2" data-onsuccess="onSignIn" data-theme="dark"></div>
<script>
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
console.log("ID: " + profile.getId());
console.log("Name: " + profile.getName());
console.log("Image URL: " + profile.getImageUrl());
console.log("Email: " + profile.getEmail());
var id_token = googleUser.getAuthResponse().id_token;
console.log("ID Token: " + id_token);
alert(id_token);
}
</script>
</body>
</html>
I get an id_token warning.
But I need to convert to angular.
I tried to implement in angularjs but did not work.
Please help me.
Expect: I only need to get id_token (not access token) from google oauth in angularjs.
source
share