Repository navigation
feat: Add Microsoft Identity Provider - #4716
Conversation
|
Hi @marcelomendoncasoares, |
marcelomendoncasoares
left a comment
There was a problem hiding this comment.
Another great work, @vfiruz97!! Just one comment on the style of the widget. Very nice to see this provider built with the Oauth2 utils you've built for GitHub. Already paying off :)
|
@vfiruz97 Let's just first fix the GitHub IDP icon before merging this PR so we can release a patch version right away. Otherwise we'll need to either branch the 3.3.0 to fix the logo or await for the next minor with the new providers. |
Await a fix on other part of the framework before merging this to release the fix as patch version. Otherwise, this feature would require bumping to next minor version.
fe9c00f to
1dc94f0
Compare
|
I rebased with |
|
I noticed your update to #4723, thanks for that. I've mirrored those changes for the Microsoft IDP button.
|
There was a problem hiding this comment.
Thanks, @vfiruz97!! Now it is ready to merge! I'll just merge main first and generate the models to incorporate the latest changes to the repository class.


This PR adds Microsoft OAuth authentication support to the
serverpod_authmodule. It implements a complete Microsoft identity provider (IDP) using the OAuth 2.0 Authorization Code flow with PKCE, with cross-platform support and no additional dependencies.Key features:
common,organizations,consumers, or specific tenant ID)Dependencies added:
None. Unlike other OAuth providers that have well-maintained official Flutter packages, there is no official or reliably maintained Microsoft OAuth package for Flutter. Instead, this implementation reuses the existing
OAuth2PkceUtilinfrastructure (shared with the GitHub IDP) for both client-side authorization and server-side token exchange. This keeps the dependency footprint minimal and consistent with the existing codebase.Note on
includeClientSecret: Microsoft's OAuth2 implementation differs from most providers, public clients (mobile, desktop) using PKCE must not include theclient_secretin the token exchange request, while confidential clients (web) must include it. To accommodate this, the sharedOAuth2PkceUtil.exchangeCodeForToken()method was extended with anincludeClientSecretparameter. The Microsoft IDP sets this based on theisWebPlatformflag sent from the client. This change is backward-compatible, the default remains true, so existing providers like GitHub are unaffected. This also confirms thatOAuth2PkceUtilis now flexible enough to support providers with varying credential requirements.Demo:
A short video demonstration of Microsoft Sign-In working end-to-end is available here: e2e test video
Fixes #3923.
Pre-launch Checklist
///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar.If you need help, consider asking for advice on the discussion board.
Breaking changes
None. This is a new feature that adds Microsoft Identity provider to auth module without modifying existing authentication methods or APIs.