Documentation Index
Fetch the complete documentation index at: https://auth0.com/llms.txt
Use this file to discover all available pages before exploring further.
Add login to your UWP application
This guide demonstrates how to integrate Auth0 with a Universal Windows Platform (UWP) application using the Auth0.OidcClient.UWP SDK. By the end, your app will support login, logout, and displaying user profile information. This guide usesAuth0.OidcClient.UWP version 1.x.
Prerequisites
You’ll need the following before you start:- Visual Studio 2019 (16.11+) or Visual Studio 2022 with the “Universal Windows Platform Development” workload installed
- Windows 10 SDK 10.0.16299 or later (installed with the UWP workload)
- An Auth0 account (sign up for free)
Get Started
Configure your Auth0 application
You need to set up an Auth0 application in your Auth0 Dashboard so your UWP app can connect.Next, configure your callback URL:
- Navigate to the Auth0 Dashboard and log in
- Go to Applications > Applications in the left sidebar
- Select Create Application
- Enter a name for your application (for example, “My UWP App”)
- Select Native as the application type
- Select Create
- Go to the Settings tab on the Application Details page
- Note your Domain and Client ID at the top of the page—you’ll need these in your code
Note the Domain and Client ID values — you need these later
- On the Settings tab, scroll down to Application URIs
- In the Allowed Callback URLs field, enter:
https://{yourDomain}/mobile- Example:
https://mycompany.auth0.com/mobile
- Example:
- In the Allowed Logout URLs field, enter the same URL:
https://{yourDomain}/mobile - Select Save Changes
The callback URL pattern
https://{yourDomain}/mobile is Auth0’s standard for native applications. Your UWP app will automatically handle the redirect - no custom configuration needed.Create your UWP project
If you already have a UWP project, skip to Step 3.
- Open Visual Studio
- Select File > New > Project
- Search for “UWP” and select Blank App (Universal Windows)
- Name your project (for example, “Auth0Sample”)
- Select Next
- For “Minimum version,” select Windows 10 (version 1909) or later
- For “Target version,” select the latest available (currently Windows 11)
- Select Create
MainPage.xaml and MainPage.xaml.cs.Install the Auth0 SDK
Add the Auth0.OidcClient.UWP NuGet package to your project.Using Package Manager UI (Recommended):Or using dotnet CLI:Verify the installation completed without errors. If you see error messages, check your internet connection and try again.
- Right-click your project in Solution Explorer
- Select Manage NuGet Packages
- Go to the Browse tab
- Search for “Auth0.OidcClient.UWP”
- Select the latest version and click Install
- Accept any dependency prompts
Add login and logout to your main page
Now you’ll add login and logout buttons to your app. Update your Now update Replace the placeholders in the code:
MainPage.xaml and MainPage.xaml.cs.First, update MainPage.xaml:MainPage.xaml.cs:{yourDomain}- Your Auth0 domain (e.g.,mycompany.auth0.com){yourClientId}- Your Auth0 application Client IDAuth0Sample- Your actual project name (match your UWP project name)
Run your app
Press F5 or select Debug > Start Debugging to launch your app.Expected behavior:
- Your UWP app launches and shows a “Login” button
- You tap Login → A browser window opens showing the Auth0 login page
- Enter your Auth0 credentials (or create a test account)
- After login, the browser closes automatically
- Your app shows your name and email
- The button changes to “Logout”
- You tap Logout → The browser opens briefly, then closes
- The button changes back to “Login”
CheckpointYou now have a fully functional Auth0 login experience in your UWP application.
Troubleshooting
Login page doesn't open
Login page doesn't open
Problem: Network connectivity issue or invalid configuration.Solution:
- Check your internet connection
- Verify your Domain is exactly correct (e.g.,
mycompany.auth0.com) - Verify your ClientId is exactly correct (no spaces or typos)
- Make sure you’re running on Windows 10 (Fall Creators Update) or later
Callback URL mismatch error
Callback URL mismatch error
Problem: The redirect URL in your Auth0 application doesn’t match the one in your code.Solution:
- Go to Auth0 Dashboard > Applications > Your App > Settings
- Scroll to “Application URIs”
- Check that “Allowed Callback URLs” contains:
https://{yourDomain}/mobile - Verify this matches the
RedirectUriin your code exactly - Click Save Changes if you made any edits
Application crashes after login
Application crashes after login
Problem: Missing using statements or incorrect namespace references.Solution:
- Make sure you have
using Auth0.OidcClient;at the top of MainPage.xaml.cs - Rebuild the solution (Build > Rebuild Solution)
Invalid grant error during login
Invalid grant error during login
Problem: Your refresh token expired or the cached credentials are invalid.Solution:
- Tap Logout to clear cached tokens
- Tap Login again and re-authenticate
- If the problem persists, go to Auth0 Dashboard and clear your app’s refresh tokens
No user information is displayed
No user information is displayed
Problem: The
profile scope wasn’t requested, so user claims aren’t available.Solution:- Update your Auth0ClientOptions to request the profile scope:
- Log out and log in again to get the updated scopes
Next Steps
You now have a working Auth0 integration in your UWP application. Explore these topics to extend your implementation:Call a Protected API
Use your access token to authenticate requests to a backend API
Refresh Tokens
Maintain user sessions across app restarts
Organizations
Support multi-tenant, B2B applications
Customize Universal Login
Match Auth0’s login page to your brand
Role-Based Access Control
Control user permissions based on roles
Additional Resources
Auth0 OIDC Client
SDK source code and documentation on GitHub
OpenID Connect
Learn how OpenID Connect works with Auth0
Access Token Best Practices
Security best practices for access tokens