3838
3939import { assertConfig } from "./lib/assert.js"
4040import { ErrorPageLoop } from "./errors.js"
41- import { AuthInternal , skipCSRFCheck } from "./lib/index.js"
41+ import { AuthInternal , raw , skipCSRFCheck } from "./lib/index.js"
4242import renderPage from "./lib/pages/index.js"
4343import { logger , setLogger , type LoggerInstance } from "./lib/utils/logger.js"
4444import { toInternalRequest , toResponse } from "./lib/web.js"
@@ -54,7 +54,7 @@ import type {
5454import type { Provider } from "./providers/index.js"
5555import { JWTOptions } from "./jwt.js"
5656
57- export { skipCSRFCheck }
57+ export { skipCSRFCheck , raw }
5858
5959/**
6060 * Core functionality provided by Auth.js.
@@ -137,6 +137,9 @@ export async function Auth(
137137
138138 const internalResponse = await AuthInternal ( internalRequest , config )
139139
140+ // @ts -expect-error TODO: Fix return type
141+ if ( config . raw === raw ) return internalResponse
142+
140143 const response = await toResponse ( internalResponse )
141144
142145 // If the request expects a return URL, send it as JSON
@@ -337,6 +340,7 @@ export interface AuthConfig {
337340 /** @todo */
338341 trustHost ?: boolean
339342 skipCSRFCheck ?: typeof skipCSRFCheck
343+ raw ?: typeof raw
340344 /**
341345 * When set, during an OAuth sign-in flow,
342346 * the `redirect_uri` of the authorization request
0 commit comments