User Tools

Site Tools


en:public:developer:template_system:tags:authentication:google_oauth2callback

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:public:developer:template_system:tags:authentication:google_oauth2callback [2013/04/05 18:27]
svanderclock created
en:public:developer:template_system:tags:authentication:google_oauth2callback [2013/04/06 00:22] (current)
svanderclock [Parameters]
Line 1: Line 1:
 ====== <#google_oauth2callback> ====== ====== <#google_oauth2callback> ======
  
-This function check the google OAuth 2.0 authentification, if success login the user or register +This function check the google OAuth 2.0 authentification (https://developers.google.com/accounts/docs/OAuth2WebServer), 
 +if success login the user or register him. Typically, the website open a popup to the url  
 +https://accounts.google.com/o/oauth2/auth with a redirect_uri to a link that contain this function. The function  
 +itself will be responsible to login or create (and login) the user and the template 
 +of this function will be responsible to close the popup and reload the parent document
 ==== Parameters ==== ==== Parameters ====
  
-Parameters are taken from tag (defaultor from HTTP GET/Post+^ Name                                                          ^ Mandatory ^ Default ^ Description       ^        
 +| <html><span style="color:#008000">template</span></html>      | No        |         | Used to build the content of the result | 
 +| <html><span style="color:#008000">client_id</span></html>     | Yes       |         | The client_id obtained during application registration (https://code.google.com/apis/console/
 +| <html><span style="color:#008000">client_secret</span></html> | Yes       |         | The client secret obtained during application registration (https://code.google.com/apis/console/) | 
 +| <html><span style="color:#008000">redirect_uri</span></html>  | No        | /authentication/google_oauth2callback       | The URI registered with the application | 
 + 
 +==== Example ==== 
 + 
 +<code html>
  
-^ Name                                                     ^ Mandatory ^ Description       ^        +<#{google_oauth2callback client_id="..." client_secret="..." redirect_uri="..."> 
-<html><span style="color:#008000">template</span></html| No        | Used to build the content of the result |+  <#{template> 
 +    <script type="text/javascript"> 
 +    //<![CDATA[ 
 +    <#if condition="<#AMRequest.values['error'] checksum=1>"> 
 +      var success = false; 
 +    <#else> 
 +      var success = true; 
 +    <#endif> 
 +  
 +    (function(){ 
 +      if((window.opener !== null) && success){ 
 +        window.opener.location = window.opener.location; 
 +      } 
 +      window.close(); 
 +    })(); 
 +    //]]> 
 +    </script> 
 +  <#}template>     
 +<#}google_oauth2callback>
  
 +</code>
en/public/developer/template_system/tags/authentication/google_oauth2callback.1365172044.txt.gz · Last modified: 2013/04/05 18:27 by svanderclock