Xamarin – How to get a offline token in .NET’s Microsoft Authentication (MSAL)?

I have a Xamarin.Forms iOS/Android application that must authenticate users against Microsoft Azure B2C AD.

I added Microsoft. Identity.Client NuGet and use it for authentication.

Login works fine, I can use the returned token to call our own Azure hosting service.

The application also requires Work offline, according to my understanding from Azure AD B2C preview: Token reference, if I provide the scope offline_access, I should be able to get a “refresh token” with a longer lifetime.

However, if I provide In this range, the library will throw an exception that does not support offline_access.

My question is: this is because MSAL currently does not support offline_access at all, or should I get the same content in a different way?

I use Microsoft.Experimental.IdentityModel.Clients.ActiveDirectory, you can install it from the Package Manager console It

install-package Microsoft.Experimental.IdentityModel.Clients.ActiveDirectory -pre

Sample:

> https ://github.com/KaiWalter/B2C-NativeClient-Xamarin
> https://github.com/KaiWalter/B2C-NativeClient-WindowsPhone8.1

I guess one of the samples can also be applied In UWP

I have a Xamarin.Forms iOS / Android application, and the user must be authenticated against Microsoft Azure B2C AD.

I added the Microsoft.Identity.Client NuGet and used it for authentication.

Login works fine and I can use the returned token to call our own Azure hosting service.

The application also needs to work offline, according to my understanding from Azure AD B2C preview: Token reference, if I provide the scope offline_access, I should be able to get a “refresh token” with a longer lifespan.

However, if I provide this range, the library will throw an exception that does not support offline_access.

My question is: this is because MSAL currently does not support offline_access at all, or I should get it in a different way The same content?

I use Microsoft.Experimental.IdentityModel.Clients.ActiveDirectory, you can install it from the Package Manager console

< /p>

install-package Microsoft.Experimental.IdentityModel.Clients.ActiveDirectory -pre

Sample:

> https://github.com/KaiWalter/B2C-NativeClient -Xamarin
> https://github.com/KaiWalter/B2C-NativeClient-WindowsPhone8.1

I guess one of the samples can also be applied to UWP

Leave a Comment

Your email address will not be published.