Rediģēt

Kopīgot, izmantojot


Enable authentication and authorization in Azure Container Apps with Facebook

This article explains how to configure Azure Container Apps to use Facebook as an authentication provider.

To follow the procedure in this article, you need a Facebook account with a verified email address and a mobile phone number. To create a new Facebook account, go to facebook.com.

Register your application with Facebook

  1. 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.

  2. Select My Apps > Add New App.

  3. In Display Name field:

    1. Type a unique name for your app.
    2. Provide your Contact Email.
    3. Select Create App ID.
    4. Complete the security check.

    The developer dashboard for your new Facebook app opens.

  4. Select Dashboard > Facebook Login > Set up > Web.

  5. In the left navigation under Facebook Login, select Settings.

  6. In the Valid OAuth redirect URIs field, enter https://<hostname>.azurecontainerapps.io/.auth/login/facebook/callback. Remember to use the hostname of your container app.

  7. Select Save Changes.

  8. In the left pane, select Settings > Basic.

  9. In the App Secret field, select Show. Copy the values of App ID and App Secret. You use them later to configure your container app in Azure.

    Important

    The app secret is a critical security credential. Don't share this secret with anyone or distribute it within a client application.

  10. 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

  1. Sign in to the Azure portal and navigate to your app.

  2. Select Authentication in the menu on the left. Select Add identity provider.

  3. Select Facebook in the identity provider dropdown. Paste in the App ID and App Secret values that you obtained previously.

    The secret is stored as a secret in your container app.

  4. If you're configuring the first identity provider for this application, you're prompted with a Container Apps authentication settings section. Otherwise, you might move on to the next step.

    These options determine how your application responds to unauthenticated requests. The default selections redirect all requests to sign 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.

  5. (Optional) Select Next: Scopes and add any scopes needed by the application. These scopes are requested when a user signs in for browser-based flows.

  6. Select Add.

You're now ready to use Facebook for authentication in your app. The provider is listed on the Authentication screen. From there, you can edit or delete this provider configuration.

Working with authenticated users

Use the following guides for details on working with authenticated users.

Next steps