File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -259,6 +259,28 @@ export function createHonoApp(options: ObjectStackHonoOptions): Hono {
259259 authService = null ;
260260 }
261261
262+ // Handle /auth/config endpoint specifically (not handled by better-auth)
263+ if ( path === 'config' && method === 'GET' && authService ) {
264+ try {
265+ const config = ( authService as any ) . getPublicConfig ?.( ) ;
266+ if ( config ) {
267+ return c . json ( {
268+ success : true ,
269+ data : config ,
270+ } ) ;
271+ }
272+ } catch ( error ) {
273+ const err = error instanceof Error ? error : new Error ( String ( error ) ) ;
274+ return c . json ( {
275+ success : false ,
276+ error : {
277+ code : 'auth_config_error' ,
278+ message : err . message ,
279+ } ,
280+ } , 500 ) ;
281+ }
282+ }
283+
262284 if ( authService && typeof authService . handleRequest === 'function' ) {
263285 const response = await authService . handleRequest ( c . req . raw ) ;
264286 return new Response ( response . body , {
Original file line number Diff line number Diff line change @@ -815,11 +815,13 @@ describe('AuthManager', () => {
815815 id : 'google' ,
816816 name : 'Google' ,
817817 enabled : true ,
818+ type : 'social' ,
818819 } ) ;
819820 expect ( config . socialProviders [ 1 ] ) . toEqual ( {
820821 id : 'github' ,
821822 name : 'GitHub' ,
822823 enabled : true ,
824+ type : 'social' ,
823825 } ) ;
824826
825827 // Should NOT include sensitive data
@@ -899,6 +901,7 @@ describe('AuthManager', () => {
899901 id : 'customProvider' ,
900902 name : 'CustomProvider' ,
901903 enabled : true ,
904+ type : 'social' ,
902905 } ) ;
903906 } ) ;
904907 } ) ;
Original file line number Diff line number Diff line change @@ -246,27 +246,11 @@ export class AuthPlugin implements Plugin {
246246
247247 const rawApp = ( httpServer as any ) . getRawApp ( ) ;
248248
249- // Register auth config endpoint - public endpoint for frontend discovery
250- rawApp . get ( `${ basePath } /config` , async ( c : any ) => {
251- try {
252- const config = this . authManager ! . getPublicConfig ( ) ;
253- return c . json ( {
254- success : true ,
255- data : config ,
256- } ) ;
257- } catch ( error ) {
258- const err = error instanceof Error ? error : new Error ( String ( error ) ) ;
259- ctx . logger . error ( 'Auth config error:' , err ) ;
260-
261- return c . json ( {
262- success : false ,
263- error : {
264- code : 'auth_config_error' ,
265- message : err . message ,
266- } ,
267- } , 500 ) ;
268- }
269- } ) ;
249+ // NOTE: The `/config` endpoint is now handled in the Hono adapter itself
250+ // (packages/adapters/hono/src/index.ts) to avoid route ordering conflicts.
251+ // The adapter's catch-all `/auth/*` route intercepts all auth requests
252+ // before plugin routes can be registered, so we check for `/config` there
253+ // and call getPublicConfig() directly on the auth service.
270254
271255 // Register wildcard route to forward all auth requests to better-auth.
272256 // better-auth is configured with basePath matching our route prefix, so we
You can’t perform that action at this time.
0 commit comments