@duongtrungnguyen/next-helper
Version:
Helper library for Next.js 15
14 lines • 836 B
TypeScript
import { type NextRequest, NextResponse } from "next/server";
/**
* Updates the session by refreshing the access token if necessary.
*
* This function checks the validity of the current access token and attempts to refresh it using the refresh token if the access token is expired or about to expire.
* It sets the new access and refresh tokens in the response cookies if the refresh is successful.
*
* @param {NextRequest} request - The incoming request object containing cookies with access and refresh tokens.
* @returns {Promise<NextResponse>} - The response object with updated cookies if the tokens were refreshed.
*
* @throws {Error} - If there is an error during the token refresh process.
*/
export declare function authMiddleware(request: NextRequest): Promise<NextResponse>;
//# sourceMappingURL=middleware.d.ts.map