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

Token expires_in returned from auth server as string #40

Open
flackenstein opened this issue Sep 22, 2023 · 0 comments
Open

Token expires_in returned from auth server as string #40

flackenstein opened this issue Sep 22, 2023 · 0 comments

Comments

@flackenstein
Copy link

flackenstein commented Sep 22, 2023

Working with a NetDocuments OAuth server it returns the client credentials token with expires_in formatted as a string and not a number.

Would it be possible to modify grant_base.ts parseTokenResponse method to support expires_in as both number and string and convert to number if needed prior to assignment to tokens.expires_in?

Example Concept...

if (
  ! ['number', 'string'].includes(typeof body.expires_in)
) {
  throw new TokenResponseError(
    "expires_in is not a string or number",
    response,
  );
}

....

if (body.expires_in) {
  if (typeof body.expires_in == 'string') {
    body.expires_in = parseInt(body.expires_in);
  }
  tokens.expiresIn = body.expires_in;
}
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