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

Xero scopes result in keychain error: "The stub received bad data" #8

Closed
jeffpollard-aiimi opened this issue May 27, 2020 · 2 comments

Comments

@jeffpollard-aiimi
Copy link

On Windows 10, we use a xoauth client configuration to access a registered Xero application. The xoauth client configuration is set to use the authorisation_code grant type, and includes the following Xero scopes:

  • openid
  • offline_access
  • email
  • profile
  • accounting.settings.read
  • accounting.contacts.read
  • accounting.transactions.read

This configuration was working fine until a few days ago. Now, when I use xoauth to connect, although the Xero API successfully returns an access token + refresh token + identity token as before, xoauth fails with the following error:

Storing tokens in local keychain
failed to save tokens to keychain: The stub received bad data.

The only configuration which now seems to be working is:

  • Both the Xero application and the xoauth configuration are configured to use the PKCE grant type
  • The xoauth configuration does not include the secret (optional with PKCE)
  • The xoauth configuration does not include the offline_access scope

With the above combination, xoauth stores the tokens successfully in the keychain. But since there is no refresh token to store (Xero returns an empty value), then there is no option to refresh and the authorisation period is limited to 30 minutes.

Is anyone else affected by this error, or can anyone advise if the above configuration is incorrect?

Many thanks!

@j4de
Copy link

j4de commented Aug 18, 2020

I have this exact same issue?!?

XOAuth is broken and doesn't work?!?!?

I'm trying to migrate an OAuth1a app to OAuth2 and this is proving extremely difficult when Xero themselves are providing tooling that does not work.

Anyone there in Xero going help FIX xoauth anytime soon or respond in any way to issues for machine to machine use cases??

@JoshBarr
Copy link
Contributor

JoshBarr commented Sep 3, 2020

Hey I've taken a look into this issue on Windows. In testing, we've identified that the Windows Credentials API only supports storing approx 2.5kb in a password field. The full token set (refresh token, access token, id token) with a number of scopes exceeds this size (just!), which causes the "stub received bad data" error.

We've released v1.1.0 which works around this problem. Take it for a spin!

@JoshBarr JoshBarr closed this as completed Sep 3, 2020
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

3 participants