0

I've just started with the oauth2 and xero (using .net)

I've run through the scoop install, following the docs, grant type of 'authorization_code', scope of 'd', which gave me the access and refresh tokens.

Now when running the example project, XeroNetStandardApp, after replacing client id, secret, callback uri and tokens, I'm getting a 401 when I try to do anything after retrieving the new token.

The token refresh appears to be working fine. If I call https://api.xero.com/connections with the bearer, I get [] (so, no elements in the response), so I assume this is some type of user auth error, but I'm at a bit of a loss as to what I do here.

Any help would be much appreciated

Steve B
  • 473
  • 1
  • 4
  • 14
  • Status 401 is indeed "unauthorised", so that would suggest some issue with your access token or refresh token. What status do you get back when you try to refresh the token? And are you keeping in mind that once you've refreshed a token, that token becomes invalid - if you try to refresh it again, you won't be able to. – droopsnoot Jul 07 '20 at 08:46
  • Thanks for your answer droopsnoot, I think I've figured it out. I didn't realize you had to explicitly set the scopes when doing the powershell xoauth setup. I do this now but get a 'token is not valid yet' error in powershell. Trying in Insomnia works though, so I can now connect – Steve B Jul 09 '20 at 21:30

1 Answers1

0

When setting up xoauth via powershell, explicitly set the scopes you are wanting the user to have. This seems obvious to me now, but didn't while I was following the setup instructions

Steve B
  • 473
  • 1
  • 4
  • 14