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

Refresh token consistently results in "invalid_grant" qb.refreshUsingToken(token) #192

Open
aniespica opened this issue May 20, 2022 · 0 comments

Comments

@aniespica
Copy link

This behavior is very intermittent, occurring 2 or 1 times over the week. The new refresh token cannot get a new access token and a new refresh token.

Our code does:

  1. A function that interacts with QuickBooks API is called.
  2. The function loads the OAuth token from our database.
  3. If the access token is expired, we request a new token using the refresh token
const QuickbooksOauthClient = require("intuit-oauth");
const quickbooksOauthClient = new QuickbooksOauthClient(getOauthConfig());
const response = await quickbooksOauthClient.refreshUsingToken(clientsCredentials.RefreshToken);
  1. The new token and refresh token are saved in our database.
  2. The API is called.

When the refresh fails the response of qb.refreshUsingToken(token) is:

{
            "url": "https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer",
            "headers": {
                "date": "Fri, 13 May 2022 05:10:41 GMT",
                "content-type": "application/json;charset=utf-8",
                "content-length": "25",
                "connection": "close",
                "intuit_tid": "1-627de851-4479c0f75a6b53953216f423",
                "x-spanid": "d48d9af9-627f-4e27-80c8-d03edc70538e",
                "x-amzn-trace-id": "Root=1-627de851-4479c0f75a6b53953216f423",
                "x-content-type-options": "nosniff",
                "server": "envoy",
                "cache-control": "no-cache, no-store",
                "pragma": "no-cache",
                "x-envoy-upstream-service-time": "30",
                "strict-transport-security": "max-age=31536000"
            },
            "body": "{\"error\":\"invalid_grant\"}",
            "status": 400,
            "statusText": "Bad Request"
}

We tried multiple times to refresh the token but always responded with the error invalid_grant. Our current solution is to authenticate again with the OAuth2.0

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