<ahref="http://facebook.com"class="urlextern"title="http://facebook.com"rel="nofollow">Facebook</a> is a famous social network service. Facebook uses <ahref="http://en.wikipedia.org/wiki/OAuth2"class="urlextern"title="http://en.wikipedia.org/wiki/OAuth2"rel="nofollow">OAuth2</a> protocol to allow applications to reuse its own authentication process (it means, if your are connected to Facebook, other applications can trust Facebook and let you in).
</p>
<p>
You need <ahref="https://metacpan.org/release/Net-Facebook-Oauth2"class="urlextern"title="https://metacpan.org/release/Net-Facebook-Oauth2"rel="nofollow">Net::Facebook::Oauth2</a> package.
</p>
<p>
You need to register a new application on Facebook to get an application ID and a secret. See <ahref="https://developers.facebook.com/apps"class="urlextern"title="https://developers.facebook.com/apps"rel="nofollow">https://developers.facebook.com/apps</a> on how to do that.
In Manager, go in <code>General Parameters</code>><code>Authentication modules</code> and choose Facebook for authentication module. You can also use Facebook as user database.
</p>
<p>
Then, go in <code>Facebook parameters</code>:
</p>
<ul>
<liclass="level1"><divclass="li"><strong>Authentication level</strong>: authentication level for this module.</div>
</li>
<liclass="level1"><divclass="li"><strong>Facebook application ID</strong>: the application ID you get</div>
</li>
<liclass="level1"><divclass="li"><strong>Facebook application secret</strong>: the corresponding secret</div>
If you use Facebook as user database, declare values in exported variables:
</p>
<ul>
<liclass="level1"><divclass="li"> use any key name you want. If you want to refuse access when a data is missing, just add a “!” before the key name</div>
</li>
<liclass="level1"><divclass="li"> in the value field, set the field name. You can show them using <ahref="https://developers.facebook.com/tools/explorer"class="urlextern"title="https://developers.facebook.com/tools/explorer"rel="nofollow">Facebook Graph API explorer</a> and have a list of supported fields in the <ahref="https://developers.facebook.com/docs/graph-api/reference/user/"class="urlextern"title="https://developers.facebook.com/docs/graph-api/reference/user/"rel="nofollow">Graph API User reference</a>. For example:</div>
<ul>
<liclass="level2"><divclass="li"> cn ⇒ name</div>
</li>
<liclass="level2"><divclass="li"> mail ⇒ email</div>
</li>
<liclass="level2"><divclass="li"> sn ⇒ last_name</div>
<divclass="noteimportant">Do not query user field in exported variables, as it is already registered by the authentication module in <code>$_user</code>.
</div><divclass="notetip">You can use the same Facebook access token in your applications. It is stored in session datas under the name <code>$_facebookToken</code>