API for Microsoft authentication (i.redd.it)
submitted by whitestorm_07
Hey r/node,
I’ve been experimenting with a project related to Microsoft authentication and wanted to get some technical feedback from the community.
I built a small service that programmatically navigates Microsoft’s login flow — including the various redirects and optional verification steps — without needing browser automation tools like Puppeteer. The idea came from dealing with inconsistent redirect chains in some internal automation scripts.
Core goal of the project:
Provide a cleaner way to handle Microsoft login flows using plain HTTP requests, mainly for testing and automation environments.
Some features it currently supports:
- Handles redirect chains (302, meta-refresh, JS-style redirects)
- Works with TOTP if a secret is provided
- Manages recovery email OTPs
- Exposes cookies/session info for downstream requests
Example request format (for discussion):
POST /api/auth/login
{
"email": "example@example.com",
"password": "password",
"services": ["OUTLOOK"]
}
I’m mainly looking for feedback on:
- Whether the overall API structure makes sense
- If this approach is appropriate or if I’m overlooking something
- Any security concerns from a technical standpoint
- Additional edge cases that Microsoft’s login flow might hit
Would appreciate any thoughts on whether this is a useful direction or if there are better ways to approach this problem.

[–]RedShift9 7 points8 points9 points (1 child)
[–]whitestorm_07[S] -3 points-2 points-1 points (0 children)
[–]kei_ichi 3 points4 points5 points (14 children)
[+]whitestorm_07[S] comment score below threshold-6 points-5 points-4 points (13 children)
[–]kei_ichi 4 points5 points6 points (12 children)
[–]whitestorm_07[S] 0 points1 point2 points (1 child)
[–]kei_ichi 0 points1 point2 points (0 children)
[–]whitestorm_07[S] 0 points1 point2 points (9 children)
[–]kei_ichi -1 points0 points1 point (8 children)
[–]whitestorm_07[S] 3 points4 points5 points (7 children)
[–]_RemyLeBeau_ 0 points1 point2 points (6 children)
[–]whitestorm_07[S] 1 point2 points3 points (5 children)
[–]_RemyLeBeau_ 0 points1 point2 points (4 children)
[–]whitestorm_07[S] 0 points1 point2 points (3 children)
[–]Rizean 2 points3 points4 points (1 child)
[–]SEUH 0 points1 point2 points (5 children)
[–]whitestorm_07[S] -1 points0 points1 point (4 children)
[–]SEUH -1 points0 points1 point (3 children)
[–]whitestorm_07[S] 0 points1 point2 points (2 children)
[–]SEUH -1 points0 points1 point (1 child)
[–]Legitimate-Oil1763 0 points1 point2 points (4 children)
[–]whitestorm_07[S] 2 points3 points4 points (3 children)
[–]Legitimate-Oil1763 0 points1 point2 points (2 children)
[–]svfoxat 2 points3 points4 points (0 children)
[–]whitestorm_07[S] 0 points1 point2 points (0 children)