Microsoft Sign In Without Browser With Node

884 Views Asked by At

I'm working on a project that's trying to include microsoft sign in, in order to use information about the person that signed in.

I'm doing this as a node js app that's run from my local machine, and there is no webpage / web server involved.

Mainly wondering if it's possible to sign in with a microsoft account without having to use a browser, or getting a URL link to sign in with, and then a way for me to get the access token without needing a redirect link back to a page.

1

There are 1 best solutions below

0
On

It sounds like device code flow might meet your requirements.

Documentation for device code flow: https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-device-code

MSAL Node sample showing device code flow: https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/standalone-samples

There is also username/password flow, but that is not recommended, and MSAL Node does not support it yet. https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth-ropc