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
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 |
<#{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>