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

RPError: JWT not active yet, now 1579073794, nbf 1579073795 #327

Closed
hanselke opened this issue Jan 15, 2020 · 8 comments
Closed

RPError: JWT not active yet, now 1579073794, nbf 1579073795 #327

hanselke opened this issue Jan 15, 2020 · 8 comments

Comments

@hanselke
Copy link

SDK you're using (please complete the following information):

  • Version 4.02

Describe the bug
When you try to authenticate, it fails after callback with error in title.

This is due to the system setting a nbf (not before) timestamp to accept the calling of
await xero.setAccessTokenFromRedirectUri(url);

To Reproduce
in xero-node-oauth2-app, just try to authenticate. it happens sometimes
Expected behavior
it should work all the time

Screenshots

Additional context
i've fixed it in my own app by adding a timeout before doing anything with the callback, but it seems like it's ALWAYS 1 ms lower then nbf whenever it causes an error. maybe make the nbf slightly earlier?

@SerKnight
Copy link
Contributor

Hey @hanselke - this should be fixed in 4.1.0 due to some refactors in the XeroClient.ts file, where the clock tolerance is setup: https://github.com/XeroAPI/xero-node/blob/master/src/xeroClient.ts#L40

If still dealing with this after updating - feel free to re-open if issue persists.

@vj-varinder
Copy link

Hey @SerKnight I am facing the same issue.

  • Using SDK Version 4.1.7

I am running https://github.com/XeroAPI/xero-node-oauth2-app while authenticating I am getting the below mentioned error

image

@edwardsph
Copy link

I was getting the same issue on 4.10.3 but upgrading to 4.11.2 hasn't helped. Seems like there is still an issue.

@devinrhode2
Copy link

devinrhode2 commented Feb 2, 2022

Hey @hanselke - this should be fixed in 4.1.0 due to some refactors in the XeroClient.ts file, where the clock tolerance is setup: https://github.com/XeroAPI/xero-node/blob/master/src/xeroClient.ts#L40

Here's updated url: https://github.com/XeroAPI/xero-node/blob/4.1.0/src/xeroClient.ts#L40

@devinrhode2
Copy link

Turns out, we had this issue with a different oauth implementation, but, it turned out, that the issue is because one developer's clock was off by 2.4 MINUTES (144 seconds).

If you go to time.gov, here's what you don't want to see:
CleanShot 2022-02-02 at 09 46 54

Here's what you do want to see (very small offset):
CleanShot 2022-02-02 at 09 47 02

As long as your servers have relatively accurate time, you shouldn't have this problem.
In theory you can increase clock tolerance to accommodate more inaccurate clocks.

@venus1344
Copy link

venus1344 commented Oct 11, 2022

hello @devinrhode2

I'm just experiencing a similar issue while testing the oauth2-app (xero-node: 4.27.1). I don't quite understand the clock tolerance you're referring to on your solution above. May you shed more light on this?

Thanks

@devinrhode2
Copy link

I think ultimately you should just go to time.gov and try to tune your clock

@datluong255
Copy link

datluong255 commented Jan 9, 2023

I've come across the same situation and I just added clockTolerance >= Your clock is off by: then it worked (xero-node: 4.32.0)
image
image

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

No branches or pull requests

8 participants