I have the following code to authenticate a user via the Google+ signin button:
<html>
<head>
<!-- google api -->
<meta name="google-signin-client_id" content="xxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com">
<meta name="google-signin-scope" content="email">
</head>
<body>
<div id="google-signin"></div>
<script>
function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function () {
console.log('User signed out.');
});
function onGoogleSuccess(googleUser) {
// get the token
var id_token = googleUser.getAuthResponse().id_token;
// console.log('Logged in as: ' + googleUser.getBasicProfile().getName());
}
function onGoogleFailure(error) {
console.log(error);
}
function renderButton() {
gapi.signin2.render('google-signin', {
'scope': 'https://www.googleapis.com/auth/plus.login',
'width': 242,
'height': 56,
'longtitle': true,
'theme': 'dark',
'onsuccess': onGoogleSuccess,
'onfailure': onGoogleFailure
});
}
</script>
</body>
</html>
When I click the button, an authentication popup windows appear, and once I authorize it, the function 'onGooglesuccess' runs, but it doesn't redirect to a page. I want it to redirect to a specific .aspx page where I can grab the code, replace it with a tokrn and grab user info.
How can I do that? I tried reading the docs on Google, but I just can't figure how to do it.
I'm developing my application in ASP.NET 4.5 / C# / Javascipt