Skip to content

Commit

Permalink
Merge pull request #20 from jakubvilhan/bugfix/fix-get-token-type
Browse files Browse the repository at this point in the history
Fix update getToken to support async token fetch
  • Loading branch information
WilsonLe authored Oct 28, 2024
2 parents e16ad57 + 67f1a9f commit a90d182
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/callback-endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const createCallbackEndpoint = (
let access_token: string;

if (pluginOptions.getToken) {
access_token = pluginOptions.getToken(code);
access_token = await pluginOptions.getToken(code);
} else {
const tokenResponse = await fetch(pluginOptions.tokenEndpoint, {
method: "POST",
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export interface PluginTypes {
* Function to get token from the OAuth providers.
* If its not provided default will be used.
*/
getToken?: (code: string) => string;
getToken?: (code: string) => string | Promise<string>;

/**
* Redirect users after successful login.
Expand Down

0 comments on commit a90d182

Please sign in to comment.