Skip to content

Fix Microsoft login with signing keys that omit alg - #7

Merged
nedtwigg merged 1 commit into
mainfrom
microsoft-jwks-import
Sep 11, 2026
Merged

Fix Microsoft login with signing keys that omit alg#7
nedtwigg merged 1 commit into
mainfrom
microsoft-jwks-import

Conversation

@nedtwigg

Copy link
Copy Markdown
Member

Microsoft login completed its token exchange but failed while loading signing keys. Microsoft's public RSA JWKs omit the optional alg member; Better Auth 1.7.3 passes that missing value to importJWK, which throws a TypeError.

Use JOSE's remote JWKS resolver against the fixed Microsoft endpoint. RS256 remains pinned, and existing signature, nonce, audience, issuer, expiry and tenant/object identity checks remain intact. The Microsoft mock now omits alg, matching the production response.

Validation: reproduced the exact importer error using only Microsoft's public keys; the updated fixture failed before the fix. pnpm check passes all 160 tests, including valid Microsoft login and forged-token rejection. pnpm packages:verify passed.

@nedtwigg
nedtwigg merged commit d0055e0 into main Sep 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant