Enable authentication and authorization in Azure Container Apps with Twitter

This article shows how to configure Azure Container Apps to use Twitter as an authentication provider.

To complete the procedure in this article, you need a Twitter account that has a verified email address and phone number. To create a new Twitter account, go to [twitter.com].

Register your application with Twitter

  1. Sign in to the Azure portal and go to your application. Copy your URL. You'll use it to configure your Twitter app.

  2. Go to the [Twitter Developers] website, sign in with your Twitter account credentials, and select Create an app.

  3. Enter the App name and the Application description for your new app. Paste your application's URL into the Website URL field. In the Callback URLs section, enter the HTTPS URL of your container app and append the path /.auth/login/twitter/callback. For example, https://<hostname>.azurecontainerapps.io/.auth/login/twitter/callback.

  4. At the bottom of the page, type at least 100 characters in Tell us how this app will be used, then select Create. Select Create again in the pop-up. The application details are displayed.

  5. Select the Keys and Access Tokens tab.

    Make a note of these values:

    • API key
    • API secret key


    The API secret key is an important security credential. Do not share this secret with anyone or distribute it with your app.

Add Twitter 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 Twitter in the identity provider dropdown. Paste in the API key and API secret key values that you obtained previously.

    The secret will be stored as secret in your container app.

  4. If you're configuring the first identity provider for this application, you'll also be prompted with a Container Apps authentication settings section. Otherwise, you may 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. Select Add.

You're now ready to use Twitter for authentication in your app. The provider will be 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