page_type | languages | products | description | urlFragment | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
sample |
|
|
Learn how to acquire an access token on a console application. |
ms-identity-dotnet-desktop-tutorial |
Acquiring an access token using a console application and call APIs with the Microsoft identity platform for developers
A multi-target console application (.Net Core and .Net Framework) that acquires an access token for a protected API on Azure, using Microsoft identity platform for developers. There are steps demonstrating this scenario on Microsoft Entra ID, Azure Active Directory B2C and National Clouds.
On later steps, you will learn how to enrich the console application with a cross platform token cache and a custom Web UI (for .NET Core only).
This repository contains a progressive tutorial made of the following parts:
Sub folder | Description |
---|---|
1. Calling Microsoft Graph | This first part presents how to acquire an access token for Microsoft Graph, on Microsoft Entra ID, Azure B2C and Azure National Clouds. Each scenario is separated on its correspondent sub-folder. |
2. Cross platform token cache | This step shows how to configure a cross platform token cache (Windows, Linux and MAC) leveraging Microsoft.Identity.Client.Extensions.Msal |
3. Custom Web UI | This step shows how to customize the UI on the authorization response for a console application. |
4. Device Code flow | This step shows how to authenticate using device code flow. |
- Install .NET Core for Windows by following the instructions at dot.net/core.
- An Internet connection
- a Microsoft Entra tenant. For more information on how to get a Microsoft Entra tenant, see How to get a Microsoft Entra tenant
- A user account in your Microsoft Entra tenant.
From your shell or command line:
git clone https://github.com/Azure-Samples/ms-identity-dotnet-desktop-tutorial.git dotnet-desktop-tutorial
cd dotnet-desktop-tutorial
Given that the name of the sample is pretty long, that it has sub-folders and so are the name of the referenced NuGet packages, you might want to clone it in a folder close to the root of your hard drive, to avoid file size limitations on Windows.
Use Stack Overflow to get support from the community.
Ask your questions on Stack Overflow first and browse existing issues to see if someone has asked your question before.
Make sure that your questions or comments are tagged with [msal
dotnet
].
If you find a bug in the sample, please open an issue on GitHub Issues.
To provide a recommendation, visit the following User Voice page.
If you'd like to contribute to this sample, see CONTRIBUTING.MD.
This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.