I'm using FileMaker Pro
to update a database from using OAuth 1.0a
to 2.0
for use with Xero
but have run into a problem.
I can successfully authorize the app (step 1) and parse the returned code and state. I then need to send the code back to the token endpoint (https://identity.xero.com/connect/token) with specific headers and body. This is where I'm stuck.
Here's what's needed: A POST Request containing the following
Header 1:
Authorization: "Basic " + base64encode(client_id + ":" + client_secret)
Header 2:
Content-Type: application/x-www-form-urlencoded
Request Body:
grant_type=authorization_code
&code=xxxxxx
&redirect_uri=https://redirecturl.com
What I have done in Filemaker
is a "Insert from URL"
with the following cURL
options: (And the Xero
token endpoint as the specified URL)
"-X POST" &
" -H \"Content-Type: application/x-www-form-urlencoded\"" &
" -H \"Authorization: Basic "& Base64EncodeRFC (4648; token::client_id &":"& token::client_secret ) & "\"" &
" -d grant_type=authorization_code&code="&token::code&"&redirect_uri=https://redirecturl.com"
However when running the script it always responds with an error, invalid_grant.
I checked and am 99% sure the redirect url is consistent throughout the whole process
I'm new to cURL
and am assuming there must be something with my syntax that I can't figure out, and ideas on what it could be and any help at all is greatly appreciated!
Thanks heaps