I want to login with google plus using javascript,below is my code
index.html
Here i placed all scripts,html code
<html>
<title>Login With google plus</title>
<meta name="google-signin-client_id"
content="aaaaaaaaaaa.apps.googleusercontent.com ">
<script src="jquery.min.js"></script>
<script src="https://apis.google.com/js/client:platform.js?
onload=renderButton" async defer></script>
<script>
function onSuccess(googleUser) {
var profile = googleUser.getBasicProfile();
gapi.client.load('plus', 'v1', function () {
var request = gapi.client.plus.people.get({
'userId': 'me'
});
request.execute(function (resp) {
var profileHTML = '<div class="profile"><div class="head">Welcome
'+resp.name.givenName+'! <a href="javascript:void(0);"
onclick="signOut();">Sign out</a></div>';
profileHTML += '<img src="'+resp.image.url+'"/><div
class="proDetails"><p>'+resp.displayName+'</p>
<p>'+resp.emails[0].value+'</p><p>'+resp.gender+'</p>
<p>'+resp.id+'</p><p><a href="'+resp.url+'">View Google+ Profile</a>
</p></div></div>';
$('.userContent').html(profileHTML);
$('#gSignIn').slideUp('slow');
});
});
}
function onFailure(error) {
alert(error);
}
function renderButton() {
gapi.signin2.render('gSignIn', {
'scope': 'profile email',
'width': 240,
'height': 50,
'longtitle': true,
'theme': 'dark',
'onsuccess': onSuccess,
'onfailure': onFailure
});
}
function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function () {
$('.userContent').html('');
$('#gSignIn').slideDown('slow');
});
}
</script>
<div id="gSignIn"></div>
<div class="userContent"></div>
</html>
but when i want to login this error will show.
- That’s an error.
Error: invalid_client
The OAuth client was not found.
I can't get this error, please help me to solve this error.