Configure your App Service or Azure Functions app to use Facebook login
This article shows how to configure Azure App Service or Azure Functions to use Facebook as an authentication provider.
To complete the procedure in this article, you need a Facebook account that has a verified email address and a mobile phone number. To create a new Facebook account, go to facebook.com.
Register your application with Facebook
Go to the Facebook Developers website and sign in with your Facebook account credentials.
If you don't have a Facebook for Developers account, select Get Started and follow the registration steps.
Select My Apps > Add New App.
In Display Name field:
- Type a unique name for your app.
- Provide your Contact Email.
- Select Create App ID.
- Complete the security check.
The developer dashboard for your new Facebook app opens.
Select Dashboard > Facebook Login > Set up > Web.
In the left navigation under Facebook Login, select Settings.
In the Valid OAuth redirect URIs field, enter
https://<app-name>.azurewebsites.net/.auth/login/facebook/callback. Remember to replace
<app-name>with the name of your Azure App Service app.
Select Save Changes.
In the left pane, select Settings > Basic.
In the App Secret field, select Show. Copy the values of App ID and App Secret. You use them later to configure your App Service app in Azure.
The app secret is an important security credential. Do not share this secret with anyone or distribute it within a client application.
The Facebook account that you used to register the application is an administrator of the app. At this point, only administrators can sign in to this application.
To authenticate other Facebook accounts, select App Review and enable Make <your-app-name> public to enable the general public to access the app by using Facebook authentication.
Add Facebook information to your application
Sign in to the Azure portal and navigate to your app.
Select Authentication in the menu on the left. Click Add identity provider.
Select Facebook in the identity provider dropdown. Paste in the App ID and App Secret values that you obtained previously.
The secret will be stored as a slot-sticky application setting named
FACEBOOK_PROVIDER_AUTHENTICATION_SECRET. You can update that setting later to use Key Vault references if you wish to manage the secret in Azure Key Vault.
If this is the first identity provider configured for the application, you will also be prompted with an App Service authentication settings section. Otherwise, you may move on to the next step.
These options determine how your application responds to unauthenticated requests, and the default selections will redirect all requests to log in with this new provider. You can change customize this behavior now or adjust these settings later from the main Authentication screen by choosing Edit next to Authentication settings. To learn more about these options, see Authentication flow.
(Optional) Click Next: Scopes and add any scopes needed by the application. These will be requested at login time for browser-based flows.
You're now ready to use Facebook for authentication in your app. The provider will be listed on the Authentication screen. From there, you can edit or delete this provider configuration.
Submit and view feedback for