diff --git a/src/callback-endpoint.ts b/src/callback-endpoint.ts index e27c113..30205f0 100644 --- a/src/callback-endpoint.ts +++ b/src/callback-endpoint.ts @@ -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", diff --git a/src/types.ts b/src/types.ts index 1367a89..32c6cd4 100644 --- a/src/types.ts +++ b/src/types.ts @@ -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; /** * Redirect users after successful login.