fix(openiddict): restore OAuth endpoints in dashboard and swagger#141
Merged
antosubash merged 1 commit intomainfrom Apr 30, 2026
Merged
fix(openiddict): restore OAuth endpoints in dashboard and swagger#141antosubash merged 1 commit intomainfrom
antosubash merged 1 commit intomainfrom
Conversation
…ts escape hatch The source generator skips auto-registration of all IEndpoint implementations when a module defines ConfigureEndpoints. OpenIddictModule was using ConfigureEndpoints solely to map /oauth-callback, which silently caused /connect/authorize, /connect/token, /connect/userinfo, and /connect/endsession to never be mapped — breaking OAuth in both Swagger and the Dashboard. - Convert /oauth-callback to a regular IEndpoint with [AllowAnonymous] so the generator picks it up alongside the connect endpoints - Drop ConfigureEndpoints from OpenIddictModule - Add the roles scope to the Swagger OAuth security definition so the role claims requested by the dashboard match what Swagger advertises - Request the roles scope from the dashboard TokenTester for parity
Deploying simplemodule-website with
|
| Latest commit: |
9db6de5
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://77e11489.simplemodule-website.pages.dev |
| Branch Preview URL: | https://claude-fix-oauth-integration.simplemodule-website.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OAuth was completely broken in the dashboard's TokenTester and in Swagger UI because
/connect/authorize,/connect/token,/connect/userinfo, and/connect/endsessionwere never being mapped — they returned404.Root cause
The source generator (
framework/SimpleModule.Generator/Emitters/EndpointExtensionsEmitter.cs:35) treatsIModule.ConfigureEndpointsas an escape hatch and skips auto-registration of everyIEndpointin the module when it's present:OpenIddictModule.ConfigureEndpointsonly mapped/oauth-callback, which silently disabled the fourEndpoints/Connect/*registrations. Inspecting the generatedEndpointExtensions.g.csconfirmed only the manualConfigureEndpointscall survived for OpenIddict.Fix
/oauth-callbackto a normalIEndpoint(OAuthCallbackEndpoint) decorated with[AllowAnonymous]. The module has noRoutePrefix, so the generator maps it (and the four connect endpoints) at the app root, exactly as before.ConfigureEndpointsfromOpenIddictModuleso auto-discovery resumes.rolesscope to the Swagger OAuth security definition + requirement so it matches what OpenIddict registers and what the access token contains.rolesfrom the dashboardTokenTesterfor parity.Verification
Started the host on
https://localhost:5001and confirmed:/connect/authorize404(HTML fallback)302redirect to/Identity/Account/Login/connect/token(password grant, valid creds)404200with realaccess_tokenJWT/oauth-callback200200/swagger/v1/swagger.jsonscopesopenid, profile, emailopenid, profile, email, rolesGenerated
EndpointExtensions.g.csnow contains the expected mappings:Test plan
dotnet buildsucceeds with 0 warnings/errorshttps://localhost:5001/swagger, click Authorize, complete the flow, and confirm a token is acquiredroleclaims included/oauth-callbackstill renders the Inertia page after a successful authorization redirectGenerated by Claude Code