Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions packages/authgear-core/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,7 @@ export class _BaseAPIClient {
throw new AuthgearError("missing delegate in api client");
}

const shouldRefresh = this._delegate.shouldRefreshAccessToken();
if (shouldRefresh) {
await this._delegate.refreshAccessToken();
}
await this._delegate.refreshAccessTokenIfNeeded();

const request = new this._Request(input, init);

Expand Down
8 changes: 1 addition & 7 deletions packages/authgear-core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,10 @@ export interface _APIClientDelegate {
*/
getAccessToken(): string | undefined;

/**
* Called by the API Client before sending HTTP request.
* If true is returned, refreshAccessToken() is then called.
*/
shouldRefreshAccessToken(): boolean;

/**
* Called by the API client to refresh the access token.
*/
refreshAccessToken(): Promise<void>;
refreshAccessTokenIfNeeded(): Promise<void>;
}

/**
Expand Down