<!--
  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates
  ~ and other contributors as indicated by the @author tags.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<section id="social-facebook">
    <title>Facebook</title>
    <para>
        To enable login with Facebook you first have to create an app in the
        <ulink url="https://developers.facebook.com/">Facebook Developer Console</ulink>. Then you need to copy
        the client id and secret into the Keycloak Admin Console.
    </para>
    <orderedlist>
        <listitem>
            <para>
                Log in to the <ulink url="https://developers.facebook.com/">Facebook Developer Console</ulink>. Click
                <literal>Apps</literal> in the menu and select <literal>Create a New App</literal>. Use any value for
                <literal>Display Name</literal> and <literal>Category</literal> you want, then click the
                <literal>Create App</literal> button. Wait for the project to be created (this may take a while). If after
                creating the app you are not redirected to the app settings, click on <literal>Apps</literal> in the
                menu and select the app you created.
            </para>
        </listitem>
        <listitem>
            <para>
                Once the app has been created click on <literal>Settings</literal> in sidebar on the left. You must specify
                a contact email.  Save your changes.  Then click
                on <literal>Advanced</literal>. Under <literal>Security</literal> make sure
                <literal>Client OAuth Login</literal> is enabled. In <literal>Valid OAuth redirect URIs</literal> insert
                the <link linkend="social-callbackurl">social callback url</link>. Scroll down and click on the
                <literal>Save Changes</literal> button.
            </para>
        </listitem>
        <listitem>
            <para>
                Click <literal>Status &amp; Review</literal> and select <literal>YES</literal> for <literal>Do you want
                to make this app and all its live features available to the general public?</literal>.  You will
                not be able to set this until you have provided a contact email in the general settings of this application.
            </para>
        </listitem>
        <listitem>
            <para>
                Click <literal>Basic</literal>. Copy <literal>App ID</literal> and <literal>App Secret</literal>
                (click <literal>show</literal>) from the <ulink url="https://developers.facebook.com/">Facebook Developer Console</ulink> into the
                settings page in the Keycloak Admin Console as the <literal>Key</literal> and <literal>Secret</literal>. Then
                click <literal>Save</literal> in the Keycloak Admin Console to enable login with Facebook.
            </para>
        </listitem>
    </orderedlist>
</section>