Sha256: b02845a4f5bae30d710bdd769f41996e5dcfee89e64f7dcc58fcd18aa31dbed5
Contents?: true
Size: 1.2 KB
Versions: 3
Compression:
Stored size: 1.2 KB
Contents
// Basic hybrid auth example following the pattern at: // https://developers.google.com/api-client-library/javascript/features/authentication#Authexample jQuery(function() { return $.ajax({ url: 'https://apis.google.com/js/client:plus.js?onload=gpAsyncInit', dataType: 'script', cache: true }); }); window.gpAsyncInit = function() { gapi.auth.authorize({ immediate: true, response_type: 'code', cookie_policy: 'single_host_origin', client_id: 'YOUR_CLIENT_ID', scope: 'email profile' }, function(response) { return; }); $('.googleplus-login').click(function(e) { e.preventDefault(); gapi.auth.authorize({ immediate: false, response_type: 'code', cookie_policy: 'single_host_origin', client_id: 'YOUR_CLIENT_ID', scope: 'email profile' }, function(response) { if (response && !response.error) { // google authentication succeed, now post data to server. jQuery.ajax({type: 'POST', url: "/auth/google_oauth2/callback", data: response, success: function(data) { // response from server } }); } else { // google authentication failed } }); }); };
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
omniauth-google-oauth2-0.4.1 | examples/auth.js |
omniauth-google-oauth2-0.4.0 | examples/auth.js |
omniauth-google-oauth2-0.3.1 | examples/auth.js |