-
Notifications
You must be signed in to change notification settings - Fork 374
Ubuntu Compile and Run Tips
SameerK-MSFT edited this page Feb 7, 2022
·
2 revisions
Create a console app for linux testing. Right now, it tests #2839
class Program
{
public static string ClientID = "your client id"; //msidentity-samples-testing tenant
public static string[] Scopes = { "User.Read" };
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
var pcaBuilder = PublicClientApplicationBuilder.Create(ClientID)
.WithRedirectUri("http://localhost")
.Build();
AcquireTokenInteractiveParameterBuilder atparamBuilder = pcaBuilder.AcquireTokenInteractive(Scopes);
AuthenticationResult authenticationResult = atparamBuilder.ExecuteAsync().GetAwaiter().GetResult();
System.Console.WriteLine(authenticationResult.AccessToken);
}
}
In a Ubuntu machine
- Download VS Code
- Copy the files from the download folder to an "App" folder.
- Download the NuGet package in ~/LocalNuget folder.
From the VS Code terminal
- Go to the "App" folder
- Run command
dotnet add package Microsoft.Identity.Client --prerelease -s ~/LocalNuget
This will add the latest package to the project - Run command
dotnet build
This will build the app in debug mode
From the Powershell terminal
- Got to "App"/bin/Debug/net6 folder
- Run command
dotnet TestApp.dll
This runs the app - To test in Sudo mode, run the following command
sudo dotnet TestApp.dll
- Home
- Why use MSAL.NET
- Is MSAL.NET right for me
- Scenarios
- Register your app with AAD
- Client applications
- Acquiring tokens
- MSAL samples
- Known Issues
- Acquiring a token for the app
- Acquiring a token on behalf of a user in Web APIs
- Acquiring a token by authorization code in Web Apps
- AcquireTokenInteractive
- WAM - the Windows broker
- .NET Core
- Maui Docs
- Custom Browser
- Applying an AAD B2C policy
- Integrated Windows Authentication for domain or AAD joined machines
- Username / Password
- Device Code Flow for devices without a Web browser
- ADFS support
- High Availability
- Regional
- Token cache serialization
- Logging
- Exceptions in MSAL
- Provide your own Httpclient and proxy
- Extensibility Points
- Clearing the cache
- Client Credentials Multi-Tenant guidance
- Performance perspectives
- Differences between ADAL.NET and MSAL.NET Apps
- PowerShell support
- Testing apps that use MSAL
- Experimental Features
- Proof of Possession (PoP) tokens
- Using in Azure functions
- Extract info from WWW-Authenticate headers
- SPA Authorization Code