Skip to content

Commit

Permalink
Add refreshAccessToken() to Figma provider (#258)
Browse files Browse the repository at this point in the history
Co-authored-by: Hurby <[email protected]>
Co-authored-by: Marvin <[email protected]>
Co-authored-by: Christoph <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
5 people authored Jan 22, 2025
1 parent 719d5f3 commit 7235aa5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/providers/figma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { OAuth2Tokens } from "../oauth2.js";

const authorizationEndpoint = "https://www.figma.com/oauth";
const tokenEndpoint = "https://www.figma.com/api/oauth/token";
const refreshEndpoint = "https://api.figma.com/v1/oauth/refresh";

export class Figma {
private client: OAuth2Client;
Expand All @@ -21,4 +22,9 @@ export class Figma {
const tokens = await this.client.validateAuthorizationCode(tokenEndpoint, code, null);
return tokens;
}

public async refreshAccessToken(refreshToken: string): Promise<OAuth2Tokens> {
const tokens = await this.client.refreshAccessToken(refreshEndpoint, refreshToken, []);
return tokens;
}
}

0 comments on commit 7235aa5

Please sign in to comment.