Skip to content

Commit

Permalink
Include refreshToken in Verify (#32)
Browse files Browse the repository at this point in the history
* Added refreshToken to verify
AS A trusted store
I WANT a refreshToken
SO THAT I can continue working by refreshing the accessToken beyond the 2hr expiry window

* Added refreshToken to verify
AS A trusted store
I WANT a refreshToken
SO THAT I can continue working by refreshing the accessToken beyond the 2hr expiry window
  • Loading branch information
hgeldenhuys authored Feb 11, 2024
1 parent 236d651 commit b972380
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Twitter2Strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface Twitter2StrategyOptions {

export interface Twitter2StrategyVerifyParams {
accessToken: string;
refreshToken: string;
expiresIn: number;
scope: string;
context?: AppLoadContext;
Expand Down Expand Up @@ -178,12 +179,13 @@ export class Twitter2Strategy<User> extends Strategy<
}
const body = await response.json();
debug("access token " + JSON.stringify(body));
const { expires_in, access_token, scope } = body;
const { expires_in, access_token, scope, refresh_token } = body;

// Verify the user and return it, or redirect
try {
user = await this.verify({
accessToken: access_token,
refreshToken: refresh_token,
expiresIn: expires_in,
scope,
context: options.context,
Expand Down

0 comments on commit b972380

Please sign in to comment.