Jump to content

Xero integration using OAuth 2.0


Recommended Posts

Hi all.

I need to upgrade my Xero integration to use OAuth 2.0 and I'm struggling with 1 element.

I have my Client Id and Client Secret and I can get an Authorization Code but I can't then get the required token.

The Xero documentation says the token request requires:

POST https://identity.xero.com/connect/token
authorization: "Basic " + base64encode(client_id + ":" + client_secret)
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code
&code=xxxxxx
&redirect_uri=https://myapp.com/redirect

My request always returns {"error":"invalid_client"}

I'm using an insert from URL with the following cURL options:

"-X POST" &

" -H \"Content-Type: application/x-www-form-urlencoded\"" &

" -H \"Authorization: \"Basic \""& Base64Encode (ACT_SET::ClientId &":"& ACT_SET::ClientSecret) & "\"" &

" --data-urlencode grant_type=authorization_code" & ¶ & 
" --data-urlencode code="&ACT::AuthorizationCode&¶ & 
"--data-urlencode redirect_uri=https://xxxxxxx.com/"

I'm assuming the issue lies in the syntax of " -H \"Authorization: \"Basic \""& Base64Encode (ACT_SET::ClientId &":"& ACT_SET::ClientSecret) & "\"" & but I've tried everything I can think of and I'm getting no further.

 

Any help would be much appreciated.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.