How to configure your App Service application to use Facebook login
This topic shows you how to configure Azure App Service to use Facebook as an authentication provider.
To complete the procedure in this topic, you must have a Facebook account that has a verified email address and a mobile phone number. To create a new Facebook account, go to facebook.com.
- Log on to the Azure portal, and navigate to your application. Copy your URL. You will use this to configure your Facebook app.
- In another browser window, navigate to the Facebook Developers website and sign-in with your Facebook account credentials.
- (Optional) If you have not already registered, click Apps > Register as a Developer, then accept the policy and follow the registration steps.
- Click My Apps > Add a New App.
- In Display Name, type a unique name for your app. Also provide your Contact Email, and then click Create App ID and complete the security check. This takes you to the developer dashboard for your new Facebook app.
- Under Facebook Login, click Set up, and then choose Settings in the left-hand navigation under Facebook Login.
Add your application's Redirect URI to Valid OAuth redirect URIs, then click Save Changes.
Your redirect URI is the URL of your application appended with the path, /.auth/login/facebook/callback. For example,
https://contoso.azurewebsites.net/.auth/login/facebook/callback. Make sure that you are using the HTTPS scheme.
In the left-hand navigation, click Settings > Basic. On the App Secret field, click Show, provide your password if requested, then make a note of the values of App ID and App Secret. You use these later to configure your application 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 which was used to register the application is an administrator of the app. At this point, only administrators can sign into this application. To authenticate other Facebook accounts, click App Review and enable Make
publicto enable general public access using Facebook authentication.
- Back in the Azure portal, navigate to your application. Click Settings > Authentication / Authorization, and make sure that App Service Authentication is On.
Click Facebook, paste in the App ID and App Secret values which you obtained previously, optionally enable any scopes needed by your application, then click OK.
By default, App Service provides authentication but does not restrict authorized access to your site content and APIs. You must authorize users in your app code.
- (Optional) To restrict access to your site to only users authenticated by Facebook, set Action to take when request is not authenticated to Facebook. This requires that all requests be authenticated, and all unauthenticated requests are redirected to Facebook for authentication.
- When done configuring authentication, click Save.
You are now ready to use Facebook for authentication in your app.
We'd love to hear your thoughts. Choose the type you'd like to provide:
Our feedback system is built on GitHub Issues. Read more on our blog.