Skip to content

Add forceRefresh option to getAccessToken method#85

Merged
nicknisi merged 1 commit into
mainfrom
nicknisi/force-refresh-option
May 20, 2025
Merged

Add forceRefresh option to getAccessToken method#85
nicknisi merged 1 commit into
mainfrom
nicknisi/force-refresh-option

Conversation

@nicknisi
Copy link
Copy Markdown
Member

This pull request introduces a new feature to allow forced refresh of access tokens in the Client class and adds corresponding test coverage. The most important changes include updating the getAccessToken method to support a forceRefresh option and adding a test case to verify this behavior.

New Feature: Forced Refresh of Access Tokens

  • src/create-client.ts: Updated the getAccessToken method in the Client class to accept an optional forceRefresh parameter. When forceRefresh is true, the access token is refreshed regardless of its expiration status.

Test Coverage

  • src/create-client.test.ts: Added a new test case to ensure the getAccessToken method correctly refreshes the access token when forceRefresh is set to true. The test verifies that the refreshed token has the expected claims.

@nicknisi nicknisi requested review from cmatheson and Copilot May 20, 2025 20:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a forceRefresh option to the getAccessToken method so callers can always force a token refresh, and includes a test case to validate that behavior.

  • Extend getAccessToken signature to accept an options object with forceRefresh
  • Update refresh logic to respect forceRefresh
  • Add a test in create-client.test.ts to verify forced refresh yields a new token

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/create-client.ts Changed getAccessToken() to getAccessToken(options?: { forceRefresh?: boolean }) and updated refresh condition
src/create-client.test.ts Added a new test verifying that forceRefresh: true always refreshes the access token

Comment thread src/create-client.ts
Comment thread src/create-client.ts
@nicknisi nicknisi merged commit 9776265 into main May 20, 2025
5 checks passed
@nicknisi nicknisi deleted the nicknisi/force-refresh-option branch May 20, 2025 21:26
This was referenced May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants