How to use a linking code for authentication instead of signing in and getting a redirect

Kyrok 0 Reputation points
2023-01-13T04:44:57.55+00:00

I want to setup a login system with my application that uses a linking code at micosoft.com/link instead of using oauth, as I am developing a standalone application which cant handle uri redirects as I want to be able to have my application to be run through a ssh console. Is there an article or tutorial on this? Thanks. It's mainly so I can use my application and login through a terminal only interface, using the code and logging on through another device.

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,562 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Shweta Mathur 27,711 Reputation points Microsoft Employee
    2023-01-24T05:20:03.1266667+00:00

    Hi @Kyrok ,

    Thanks for reaching out.

    It seems you are looking to authenticate in standalone system which does not rely on redirects and want to authenticate using linking code that is provided by Microsoft and can be entered into application via terminal interface.

    This can be achieved using the Microsoft Identity Platform.

    Here are the steps you can follow to set this up:

    1. Register your application in the Azure portal to obtain a client ID and client secret.
    2. Implement the "device code flow" in your application. This flow allows users to sign in by entering a code displayed in the terminal into a web browser.
    3. Send a request to the /devicecode endpoint to get a device code and user code, then display the user code in the terminal.
    4. Poll the token endpoint until the user has signed in and consented to the requested permissions. Hope this will help. Thanks,
    5. Shweta

    6. Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.
    0 comments No comments