11import { z } from 'zod'
2- import { EPIC_ME_SERVER_URL } from './client.ts'
2+ import { EPIC_ME_AUTH_SERVER_URL } from './client.ts'
33
44export type AuthInfo = Exclude <
55 Awaited < ReturnType < typeof getAuthInfo > > ,
@@ -12,7 +12,7 @@ export async function getAuthInfo(request: Request) {
1212
1313 const token = authHeader . slice ( 'Bearer ' . length )
1414
15- const validateUrl = new URL ( '/introspect' , EPIC_ME_SERVER_URL ) . toString ( )
15+ const validateUrl = new URL ( '/introspect' , EPIC_ME_AUTH_SERVER_URL ) . toString ( )
1616 const resp = await fetch ( validateUrl , {
1717 headers : { authorization : authHeader } ,
1818 } )
@@ -43,7 +43,7 @@ export function initiateOAuthFlow(request: Request) {
4343 const currentUrl = url . toString ( )
4444
4545 // Create the OAuth authorization URL
46- const authUrl = new URL ( '/authorize' , EPIC_ME_SERVER_URL )
46+ const authUrl = new URL ( '/authorize' , EPIC_ME_AUTH_SERVER_URL )
4747
4848 // Add the current URL as the redirect target
4949 authUrl . searchParams . set ( 'redirect_uri' , currentUrl )
@@ -70,7 +70,7 @@ export function initiateOAuthFlow(request: Request) {
7070export async function handleOAuthAuthorizationServerRequest ( ) {
7171 const authUrl = new URL (
7272 '/.well-known/oauth-authorization-server' ,
73- EPIC_ME_SERVER_URL ,
73+ EPIC_ME_AUTH_SERVER_URL ,
7474 )
7575 return Response . redirect ( authUrl . toString ( ) , 302 )
7676}
@@ -90,10 +90,10 @@ export async function handleOAuthProtectedResourceRequest(request: Request) {
9090 } ,
9191 authorization_servers : [
9292 {
93- issuer : EPIC_ME_SERVER_URL ,
94- authorization_endpoint : `${ EPIC_ME_SERVER_URL } /authorize` ,
95- token_endpoint : `${ EPIC_ME_SERVER_URL } /token` ,
96- introspection_endpoint : `${ EPIC_ME_SERVER_URL } /introspect` ,
93+ issuer : EPIC_ME_AUTH_SERVER_URL ,
94+ authorization_endpoint : `${ EPIC_ME_AUTH_SERVER_URL } /authorize` ,
95+ token_endpoint : `${ EPIC_ME_AUTH_SERVER_URL } /token` ,
96+ introspection_endpoint : `${ EPIC_ME_AUTH_SERVER_URL } /introspect` ,
9797 } ,
9898 ] ,
9999 } )
0 commit comments