Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isAccessTokenExpired always returns true #52

Open
PMLyf opened this issue Nov 2, 2022 · 0 comments
Open

isAccessTokenExpired always returns true #52

PMLyf opened this issue Nov 2, 2022 · 0 comments

Comments

@PMLyf
Copy link

PMLyf commented Nov 2, 2022

One line summary of the issue here.
When checking the new access token provided by requestAccessToken, isAccessTokenExpired always returns true

Expected behavior

Token should not be expired
As concisely as possible, describe the expected behavior.
requestAccessToken returns a new token with expiry time. Local checks pass for the expiry time should also pass with api call

Actual behavior

always returns true
As concisely as possible, describe the observed behavior.

Steps to reproduce the behavior

generate auth link
in call back request a new access token
check if the token is expired

Please list all relevant steps to reproduce the observed behavior.

const clientT = new auth.OAuth2User({
client_id: process.env.TWITTER_CLIENT_ID as string,
client_secret: process.env.TWITTER_CLIENT_SECRET as string,
callback: process.env.TWITTER_OAUTH_CALLBACK_URL as string,
scopes: ["tweet.read", "tweet.write", "users.read", "offline.access"],
token: {
refresh_token: refreshToken,
token_type: "refresh_token",
},
});

const isExpired = clientT.isAccessTokenExpired();
if (isExpired.valueOf()) {
logger.log("Token is expired");
const newToken = await clientT.refreshAccessToken();
logger.log("New Token: " + JSON.stringify(newToken));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant