I'm trying to build google+ sign in feature.
I'm able to get all the user data from google+, how can i insert this data into database? I know js is client-side language and it is needed to be done on server side.......
my code:

    <span id="signinButton">
        <span
        class="g-signin"
        data-callback="signinCallback"
        data-clientid="My-client-id"
        data-cookiepolicy="single_host_origin"
        data-requestvisibleactions="http://schemas.google.com/AddActivity"
        data-scope="https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email">

        </span>
    </span>



<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js" ></script>

<script type="text/javascript">
      (function() {
       var po = document.createElement('script'); 
       po.type = 'text/javascript'; po.async = true;
       po.src = 'http://apis.google.com/js/client:plusone.js';
       var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
     })();


function signinCallback(authResult) {
  if (authResult['access_token']) {
    // Successfully authorized
    // Hide the sign-in button now that the user is authorized, for example:
    gapi.client.load('plus','v1', function(){
        var request = gapi.client.plus.people.get({
        'userId': 'me'
              });
            request.execute(function(profile) {
                    var displayName = profile.displayName;
                    var google_id = profile.id;
                    var google_image = profile.image.url;
                    var google_url = profile.url;



                    console.log('Retrieved profile for:' + displayName);
                    console.log('ID: ' + google_id);
                    console.log('Image URL: ' + google_image);
                    console.log('Profile URL: ' + google_url);


            });
        });
  gapi.client.load('oauth2', 'v2', function() {
  gapi.client.oauth2.userinfo.get().execute(function(resp) {
    // Shows user email
    var email = resp.email;
    console.log('Profile email: ' + email);
  })
});

    document.getElementById('signinButton').setAttribute('style', 'display: none');

  } 

  else if (authResult['error']) {
    // There was an error.
    // Possible error codes:
    //   "access_denied" - User denied access to your app
    //   "immediate_failed" - Could not automatically log in the user
    // console.log('There was an error: ' + authResult['error']);
  }
}

</script>
<script type="text/javascript">
function disconnectUser(access_token) {
  var revokeUrl = 'https://accounts.google.com/o/oauth2/revoke?token=' +
      access_token;

  // Perform an asynchronous GET request.
  $.ajax({
    type: 'GET',
    url: revokeUrl,
    async: false,
    contentType: "application/json",
    dataType: 'jsonp',
    success: function(nullResponse) {
      // Do something now that user is disconnected
      // The response is always undefined.
    },
    error: function(e) {
      // Handle the error
      // console.log(e);
      // You could point users to manually disconnect if unsuccessful
      // https://plus.google.com/apps
    }
  });
}
</script>

how can i insert this data into database?

What (scripting) language are you using on the server?

Examples on how to use MySQLi and PDO are available in the PHP forum - Code Snippets tab.

umm.....can you post a link?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.