Configure your App Service or Azure Functions app to use X login
This article shows how to configure Azure App Service or Azure Functions to use X as an authentication provider.
To complete the procedure in this article, you need an X account that has a verified email address and phone number. To create a new X account, go to x.com.
Register your application with X
Sign in to the Azure portal and go to your application. Copy your URL. You'll use it to configure your X app.
Go to the X Developers website, sign in with your X account credentials, and select Create an app.
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 App Service app and append the path
/.auth/login/x/callback
. For example,https://contoso.azurewebsites.net/.auth/login/x/callback
.At the bottom of the page, type at least 100 characters in Tell us how this app will be used, then select Create. Click Create again in the pop-up. The application details are displayed.
Select the Keys and Access Tokens tab.
Make a note of these values:
- API key
- API secret key
Important
The API secret key is an important security credential. Do not share this secret with anyone or distribute it with your app.
Add X 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 Twitter in the identity provider dropdown. Paste in the
API key
andAPI secret key
values that you obtained previously.The secret will be stored as a slot-sticky application setting named
TWITTER_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.
Click Add.
You're now ready to use X for authentication in your app. The provider will be listed on the Authentication screen. From there, you can edit or delete this provider configuration.
Next steps
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for