UNPKG

@nhost/nhost-js

Version:

Nhost JavaScript SDK

24 lines 1.02 kB
/** * Authorization token attachment middleware for the Nhost SDK. * * This module provides middleware functionality to automatically attach * authorization tokens to outgoing API requests, ensuring the client * is properly authenticated. */ import type { SessionStorage } from '../session/storage'; import type { ChainFunction } from './fetch'; /** * Creates a fetch middleware that adds the Authorization header with the current access token. * * This middleware: * 1. Gets the current session from storage * 2. Adds the authorization header with the access token to outgoing requests * * This middleware should be used after the refresh middleware in the chain to * ensure the most recent token is used. * * @param storage - Storage implementation for retrieving session data * @returns A middleware function that adds Authorization headers */ export declare const attachAccessTokenMiddleware: (storage: SessionStorage) => ChainFunction; //# sourceMappingURL=middlewareAttachAccessToken.d.ts.map