21 lines
834 B
TypeScript
21 lines
834 B
TypeScript
|
|
import { type AccessTokens, type TokenRefreshFunction } from "../http-api/index.ts";
|
||
|
|
import { type OAuth2 } from "./index.ts";
|
||
|
|
/**
|
||
|
|
* Class responsible for refreshing OAuth2 access tokens
|
||
|
|
*/
|
||
|
|
export declare class TokenRefresher {
|
||
|
|
private readonly auth;
|
||
|
|
private readonly onRefresh;
|
||
|
|
private inflightRefreshRequest?;
|
||
|
|
constructor(auth: OAuth2, onRefresh: (tokens: AccessTokens) => Promise<void>);
|
||
|
|
/**
|
||
|
|
* Attempt token refresh using given refresh token
|
||
|
|
* @param refreshToken - refresh token to use in request with token issuer
|
||
|
|
* @returns tokens - Promise that resolves with new access and refresh tokens
|
||
|
|
* @throws when token refresh fails
|
||
|
|
*/
|
||
|
|
tokenRefreshFunction: TokenRefreshFunction;
|
||
|
|
private shouldLogoutOnError;
|
||
|
|
private getNewTokens;
|
||
|
|
}
|
||
|
|
//# sourceMappingURL=tokenRefresher.d.ts.map
|