Note: You are currently viewing documentation for Moodle 3.11. Up-to-date documentation for the latest stable version of Moodle may be available here: OAuth 2 Facebook service.

OAuth 2 Facebook service: Difference between revisions

From MoodleDocs
(new setting 'Use Strict Mode for Redirect URIs' following security update to Facebook Login)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{OAuth2}}
{{OAuth2}}
To set up an OAuth 2 client with Facebook


=== Setup App in Facebook ===
1. Log in to the page [https://developers.facebook.com/apps Facebook for Developers Apps] and click the 'Add a new app' button.


To setup  an OAuth 2 client with Facebook, first we need to log in to the [https://developers.facebook.com/apps Facebook for Developers Apps page] and create a new app.
[[File:facebook-1-new-app.png|none|frame|Add a new app]]


[[File:facebook-1-new-app.png|none|frame|New App]]
2. Enter a name and contact email and click the button 'Create App ID'.


Enter the name for the new App and choose a category (Education?).
[[File:facebook-2-name.png|none|frame|Create App ID]]


[[File:facebook-2-name.png|none|frame|Name it]]
3. Click Settings on the left, then add an app icon and URLs as desired, choose a category e.g. Education then click the button 'Save Changes'.


On the left site menu, choose "settings" and fill in the basic settings: app icon, URLs to your privacy policy and terms of service.
[[File:facebook-3-basic-settings.png|none|frame|App settings]]


[[File:facebook-3-basic-settings.png|none|frame|Basic settings]]
4. Click the link '+Add Product' on the left then for 'Facebook Login' click the button 'Get Started'.


On the left side menu, choose "+ Add product".
[[File:facebook-4-add-product.png|none|frame|Add Product]]
 
[[File:facebook-4-add-product.png|none|frame|Add a product]]
 
Add "Facebook Login" product to the app. (Choose "Get started" button)


[[File:facebook-login.png|none|frame|Facebook Login]]
[[File:facebook-login.png|none|frame|Facebook Login]]


Next, choose "Web":
5. Click Web, then enter your site URL and click Save.
 
[[File:facebook-choose-platform.png|none|frame|Choose "Web"]]
 
Next, set your site URL:
 
[[File:facebook-webapp-wizard.png|none|frame|Set site URL]]


Click "Save", Click "Continue", click "Next" several times to go to the end of the wizard, until you see the following page with the "Back" button.
[[File:facebook-webapp-wizard.png|none|frame|Enter site URL]]


Then, go to the "Settings" page on the left menu
6. Click Settings under 'Facebook Login' on the left, then configure the Client OAuth Settings as follows:


[[File:facebook-webapp-wizard-siteurl.png|none|frame|Go to the "Settings" page on the left menu]]
* Set 'Web OAuth Login' and 'Use Strict Mode for Redirect URIs' to Yes and everything else to No (for security).
* Enter the callback URL to "your site url + /admin/oauth2callback.php" e.g. <nowiki>https://lemon.edu/admin/oauth2callback.php</nowiki>.


Configure the OAuth settings. Set the callback URL to "your site url + /admin/oauth2callback.php". If your moodle site is available at <nowiki>https://lemon.edu/</nowiki> then the callback URL should be set to <nowiki>https://lemon.edu/admin/oauth2callback.php</nowiki>. Enable the Web OAuth Login but for best security disable all other types of login.
then click the button 'Save Changes'.


[[File:facebook-5-oauth-settings-v2.png|none|frame|OAuth settings]]
[[File:facebook-5-oauth-settings-v2.png|none|frame|OAuth settings]]


Go to App Review and make your App public.
7. Click 'App Review' on the left, then click to make your app public.


[[File:facebook-6-public.png|none|frame|Make it public]]
[[File:facebook-6-public.png|none|frame|Make it public]]


Finally go to the basic settings and get the App ID and App secret and enter them in Moodle as the Client ID and Client Secret.
Finally, click Dashboard on the left,  get the App ID and App Secret and enter them in Moodle as the client ID and secret.


[[File:facebook_7_app_id_and_secret.png|none|frame|Getting the App ID and Secret]]


[[es:Servicio OAuth 2 Facebook]]
[[es:Servicio OAuth 2 Facebook]]
[[de:OAuth2 Facebook Service]]

Latest revision as of 09:51, 21 December 2017

To set up an OAuth 2 client with Facebook

1. Log in to the page Facebook for Developers Apps and click the 'Add a new app' button.

Add a new app

2. Enter a name and contact email and click the button 'Create App ID'.

Create App ID

3. Click Settings on the left, then add an app icon and URLs as desired, choose a category e.g. Education then click the button 'Save Changes'.

App settings

4. Click the link '+Add Product' on the left then for 'Facebook Login' click the button 'Get Started'.

Add Product
Facebook Login

5. Click Web, then enter your site URL and click Save.

Enter site URL

6. Click Settings under 'Facebook Login' on the left, then configure the Client OAuth Settings as follows:

  • Set 'Web OAuth Login' and 'Use Strict Mode for Redirect URIs' to Yes and everything else to No (for security).
  • Enter the callback URL to "your site url + /admin/oauth2callback.php" e.g. https://lemon.edu/admin/oauth2callback.php.

then click the button 'Save Changes'.

OAuth settings

7. Click 'App Review' on the left, then click to make your app public.

Make it public

Finally, click Dashboard on the left, get the App ID and App Secret and enter them in Moodle as the client ID and secret.

Getting the App ID and Secret