diff --git a/src/cloudflare/index.ts b/src/cloudflare/index.ts index ece3f30..78b166a 100644 --- a/src/cloudflare/index.ts +++ b/src/cloudflare/index.ts @@ -158,7 +158,7 @@ * ``` * * - * @module auth-remix + * @module auth-remix/cloudflare */ import { @@ -208,7 +208,8 @@ export function RemixAuth(config: RemixAuthConfig) { "csrf", request.headers.get("x-forwarded-proto") ?? new URL( request.url ).protocol, request.headers, - process.env, + // @ts-expect-error + context.cloudflare.env, config ) @@ -232,7 +233,8 @@ export function RemixAuth(config: RemixAuthConfig) { "session", request.headers.get("x-forwarded-proto") ?? new URL( request.url ).protocol, request.headers, - process.env, + // @ts-expect-error + context.cloudflare.env, config ) @@ -269,7 +271,8 @@ export function RemixAuth(config: RemixAuthConfig) { "signin", headers.get("x-forwarded-proto") ?? new URL( request.url ).protocol, headers, - process.env, + // @ts-expect-error + context.cloudflare.env, config ) @@ -326,7 +329,8 @@ authorizationParams "signout", headers.get("x-forwarded-proto") ?? new URL( request.url ).protocol, headers, - process.env, + // @ts-expect-error + context.cloudflare.env, config ) const callbackUrl = options?.redirectTo ?? headers.get("Referer") ?? "/" diff --git a/src/deno/index.ts b/src/deno/index.ts index 79f704e..d13f817 100644 --- a/src/deno/index.ts +++ b/src/deno/index.ts @@ -158,7 +158,7 @@ * ``` * * - * @module auth-remix + * @module auth-remix/deno */ import { @@ -208,7 +208,8 @@ export function RemixAuth(config: RemixAuthConfig) { "csrf", request.headers.get("x-forwarded-proto") ?? new URL( request.url ).protocol, request.headers, - process.env, + // @ts-expect-error + Deno.env.toObject(), config ) @@ -232,7 +233,8 @@ export function RemixAuth(config: RemixAuthConfig) { "session", request.headers.get("x-forwarded-proto") ?? new URL( request.url ).protocol, request.headers, - process.env, + // @ts-expect-error + Deno.env.toObject(), config ) @@ -269,7 +271,8 @@ export function RemixAuth(config: RemixAuthConfig) { "signin", headers.get("x-forwarded-proto") ?? new URL( request.url ).protocol, headers, - process.env, + // @ts-expect-error + Deno.env.toObject(), config ) @@ -326,7 +329,8 @@ authorizationParams "signout", headers.get("x-forwarded-proto") ?? new URL( request.url ).protocol, headers, - process.env, + // @ts-expect-error + Deno.env.toObject(), config ) const callbackUrl = options?.redirectTo ?? headers.get("Referer") ?? "/" diff --git a/src/node/index.ts b/src/node/index.ts index 650a14b..c6a2d68 100644 --- a/src/node/index.ts +++ b/src/node/index.ts @@ -158,7 +158,7 @@ * ``` * * - * @module auth-remix + * @module auth-remix/node */ import { @@ -186,14 +186,12 @@ export type RemixAuthConfig = Omit export function RemixAuth(config: RemixAuthConfig) { const loader: LoaderFunction = async ({ request, params, context }) => { - // @ts-expect-error setEnvDefaults(process.env, config) config.basePath = getBasePath({ request, params }) return await Auth(request, config) } const action: ActionFunction = async ({ request, params, context }) => { - // @ts-expect-error setEnvDefaults(process.env, config) config.basePath = getBasePath({ request, params }) return await Auth(request, config) @@ -202,7 +200,6 @@ export function RemixAuth(config: RemixAuthConfig) { const getCsrfToken = async ( { request, context }: Omit< LoaderFunctionArgs | ActionFunctionArgs, "params" >, ): Promise => { - // @ts-expect-error setEnvDefaults(process.env, config) const url = createActionURL( "csrf", @@ -226,7 +223,6 @@ export function RemixAuth(config: RemixAuthConfig) { const getSession = async ( { request, context }: Omit< LoaderFunctionArgs | ActionFunctionArgs, "params" >, ): GetSessionResult => { - // @ts-expect-error setEnvDefaults(process.env, config) const url = createActionURL( "session", @@ -257,7 +253,6 @@ export function RemixAuth(config: RemixAuthConfig) { options: ({ redirectTo?: string }) = {}, authorizationParams?: string[][] | Record | string | URLSearchParams, ) => { - // @ts-expect-error setEnvDefaults(process.env, config) const headers = new Headers(request.headers) const { @@ -317,7 +312,6 @@ authorizationParams { request, context }: Omit< LoaderFunctionArgs | ActionFunctionArgs, "params" >, options: { redirectTo?: string } = {}, ) => { - // @ts-expect-error setEnvDefaults(process.env, config) const headers = new Headers( request.headers ) headers.set("Content-Type", "application/x-www-form-urlencoded")