@nhost/nhost-js
Version:
Nhost JavaScript SDK
17 lines • 1.04 kB
TypeScript
import type { Client as AuthClient } from '../auth';
import type { StoredSession } from './session';
import type { SessionStorage } from './storage';
/**
* Refreshes the authentication session if needed
*
* This function checks if the current session needs to be refreshed based on
* the access token expiration time. If a refresh is needed, it will attempt to
* refresh the token using the provided auth client.
*
* @param auth - The authentication client to use for token refresh
* @param storage - The session storage implementation
* @param marginSeconds - The number of seconds before the token expiration to refresh the session. If the token is still valid for this duration, it will not be refreshed. Set to 0 to force the refresh.
* @returns A promise that resolves to the current session (refreshed if needed) or null if no session exists
*/
export declare const refreshSession: (auth: AuthClient, storage: SessionStorage, marginSeconds?: number) => Promise<StoredSession | null>;
//# sourceMappingURL=refreshSession.d.ts.map