From 6ab565449a6e31baafa3e5b08a716e9501bebd63 Mon Sep 17 00:00:00 2001 From: Alan Bridgeman Date: Thu, 1 May 2025 12:57:47 -0500 Subject: [PATCH] An order of operations oversight in terms of needing a route to not 404 before/during the registration rather than setting it up after --- src/OAuthApp.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/OAuthApp.ts b/src/OAuthApp.ts index 6d9f2c7..a0f4e8e 100644 --- a/src/OAuthApp.ts +++ b/src/OAuthApp.ts @@ -142,6 +142,9 @@ export class OAuthApp extends App { console.log(`Attempting to create/register the app:\n\tApp Base URL: ${baseAppUrl}\n\tApp Abbreviation: ${appAbbrv}\n\tApp Name: ${typeof this.appName === 'undefined' ? 'uses APP_NAME environment variable (' + process.env.APP_NAME + ')' : this.appName}\n\tScopes: ${typeof this.scopes === 'undefined' ? 'uses SCOPES environment variable (' + process.env.SCOPES + ')' : this.scopes.join(', ')}`); + // Because we need this for registration to work properly. It make sense to put it here + app.getInitializer().getRouter().addOutsideFrameworkRoute('/.well-known/jwks.json'); + const client = await Client.setup(app.getExpressApp(), baseAppUrl, this.onAuth, this.saveSecret, appAbbrv, this.appName, this.scopes, { contacts: this.contacts, logo_url: this.logo_url, @@ -155,6 +158,7 @@ export class OAuthApp extends App { }); client.getSetupRoutes().forEach((route) => { + console.log(`Adding outside framework route: ${route}`); app.getInitializer().getRouter().addOutsideFrameworkRoute(route); }); }