Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

Device profile for devices without web browsers

Jean-Marc Prieur edited this page Feb 12, 2018 · 6 revisions

The Device Code Flow is a flow enabling text-only devices to participate in the authentication dance with Azure AD and all the power it brings despite their limitations. This is only for devices that don't offer an interactive authentication (web) experience. The principle is that the application will share with the user a code and the URL where he'll sign-in using another device enabling web interaction, then the application will wait until it gets confirmation from the STS that the has indeed signed-in before requesting a token. To use it, the application leverage two APIs. Here are the details for ADAL.NET.

In ADAL.NET this flow is available for .NET Framework, .NET Core, OSX, Linux, and Android (for iOTs). It's not available for iOS (in other words, a warning will be issued by the compiler with an explanation if it's used in a Xamarin iOS application).

image

The flow is the following:

  • The application calls one of the overrides of AcquireDeviceCodeAsync, which interacts with the STS to provide a DeviceCodeResult.

image

  • The application then displays to the user the content of the Message property of the DeviceCodeResult. This message tells the user to go to a the URL of a web site where s/he will need to provide this code and sign-in with a web enabled device (other than the device running the application as this is a text only device).
  • The application then executes AcquireTokenByDeviceCodeAsync which waits until the user has signed-in in the other web enabled device. At this time, the STS will return the token (the AuthenticationResult)

This is illustrated nicely in the https://github.com/Azure-Samples/active-directory-dotnet-deviceprofile sample (the code is in method GetTokenViaCode)

Clone this wiki locally