User Tools

Site Tools


en:public:developer:template_system:tags:authentication:facebook_oauth2callback

<#facebook_oauth2callback>

This function check the facebook OAuth 2.0 authentification (https://developers.facebook.com/docs/howtos/login/server-side-login/), if success login the user or register him. Typically, the website open a popup to the url https://www.facebook.com/dialog/oauth/ 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

Name Mandatory Default Description
template No Used to build the content of the result
client_id Yes Your FaceBook App ID
client_secret Yes Your FaceBook App secret
redirect_uri No /authentication/facebook_oauth2callback/ The URI registered with the application

Example

<#{facebook_oauth2callback client_id="..." client_secret="..." redirect_uri="...">
  <#{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>    
<#}facebook_oauth2callback>
en/public/developer/template_system/tags/authentication/facebook_oauth2callback.txt · Last modified: 2013/04/08 13:21 by svanderclock