xero-node: Authentication Error(checks.state argument is missing)

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

  • Version 4.11.2

Describe the bug Getting following error after successfully authenticating with Xero

TypeError: checks.state argument is missing
    at Client.callback (/Users/bhrigusharma/Documents/work/web-backend/node_modules/openid-client/lib/client.js:398:13)
    at XeroClient.<anonymous> (/Users/bhrigusharma/Documents/work/web-backend/node_modules/xero-node/src/XeroClient.ts:118:48)
    at Generator.next (<anonymous>)
    at /Users/bhrigusharma/Documents/work/web-backend/node_modules/xero-node/dist/XeroClient.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/bhrigusharma/Documents/work/web-backend/node_modules/xero-node/dist/XeroClient.js:4:12)
    at XeroClient.apiCallback (/Users/bhrigusharma/Documents/work/web-backend/node_modules/xero-node/dist/XeroClient.js:77:16)
    at XeroNetworkService.<anonymous> (/Users/bhrigusharma/Documents/work/web-backend/src/modules/xero/xero.network.ts:30:53)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/bhrigusharma/Documents/work/web-backend/src/modules/xero/xero.network.ts:11:58)

apiCallback is throwing the error the above error

To Reproduce Steps to reproduce the behavior:

  1. Create an auth URL using buildConsentUrl
  2. Go to the above-generated URL and authenticate successfully
  3. Pass the URL which we get after redirection to apiCallback

url passed to apiCallback is like /finishAuth?code=<code>&scope=openid%20profile%20email%20accounting.reports.read%20accounting.settings&state=<state>&session_state=<session_state>

Expected behavior Should not throw an error instead should generate tokens

Additional context I upgraded my xero-node from 4.8.1 to 4.11.2 and my authentication flow stopped working Everthing was working fine on 4.8.1

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 21 (8 by maintainers)

Most upvoted comments

This is yet another breaking change that is released as a minor version. Breaking changes should bump the major version of a package. Very frustrating.