update cloudflare context

This commit is contained in:
2025-12-17 23:52:08 -03:00
parent d683feb85f
commit be1ae656d3
25 changed files with 222 additions and 94 deletions

View File

@@ -13,13 +13,16 @@ export type User = {
refreshToken: string
}
export function createAuth(env, redirectURI = null) {
export function createAuth(
env: Record<string, any>,
redirectURI: string | null = null
) {
const authenticator = new Authenticator()
const strategy = new OAuth2Strategy(
{
clientId: env.CLIENT_ID,
clientSecret: env.CLIENT_SECRET,
redirectURI: redirectURI ?? env.REDIRECT_URI,
redirectURI: (env?.REDIRECT_URI ?? redirectURI) || undefined,
authorizationEndpoint: `${env.ISSUER_URL}/authorize`,
tokenEndpoint: `${env.ISSUER_URL}/token`,
tokenRevocationEndpoint: `${env.ISSUER_URL}/revoke`,