Skip to content

Commit a90d182

Browse files
authored
Merge pull request #20 from jakubvilhan/bugfix/fix-get-token-type
Fix update getToken to support async token fetch
2 parents e16ad57 + 67f1a9f commit a90d182

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/callback-endpoint.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const createCallbackEndpoint = (
4545
let access_token: string;
4646

4747
if (pluginOptions.getToken) {
48-
access_token = pluginOptions.getToken(code);
48+
access_token = await pluginOptions.getToken(code);
4949
} else {
5050
const tokenResponse = await fetch(pluginOptions.tokenEndpoint, {
5151
method: "POST",

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export interface PluginTypes {
115115
* Function to get token from the OAuth providers.
116116
* If its not provided default will be used.
117117
*/
118-
getToken?: (code: string) => string;
118+
getToken?: (code: string) => string | Promise<string>;
119119

120120
/**
121121
* Redirect users after successful login.

0 commit comments

Comments
 (0)