I am trying to write a simple app to integrate with my online financial software - FreeAgent - mainly to test out my skills / learn.
FreeAgent uses OAuth 2.0
I realise it is best practice to do the handling of tokens outside of Glide - but as it is just me using it - and I am just playing - I thought I would give it a go within Glide (and I have no idea how to handle the tokens outside anyway!)
I’ve created an app in my financial software - and am able to Grant access to my Glide app - and have got an authorisation code back from FreeAgent.
As I understand it from the docs, I now need to exchange that code for Access and Refresh Tokens.
I’ve been able to get both tokens using Curl - but can not get the CallAPI action to succeed in Glide. I get a 400 error usually. I realise the Authorisation token expires and is one use (took me a while to find that out!)
This is my Curl statement that works (with the codes removed)
Any ideas why the CallAPI action wouldn’t work? I am passing the code in as a variable into the Body and have the Authorisation and Content Types correctly set in the headers.
I’ve made some great progress with my FreeAgent / Glide app. I now have the OAuth 2.0 process working really well - by using a Google Apps Script between Glide and FreeAgent to handle the token exchange. Means that Glide only needs to store Client ID and retrieve a token every hour (or when needed) from GAS. Rather pleased with myself! Happy to share more info if it helps anyone else.
But now I am stumped on another part. I send an API call to FreeAgent to add an attachment (a receipt) to a transaction. I have worked out how to do it, and can successfully add receipts using postman to test. Works every time.
But when I do the same using a call API action in Glide - I get a 400 error.
I have checked over and over all the values - and they are identical.
Any reason why the call API would fail? Are there any restrictions / limits? I have made the attachment very small (100kb) - which is encoded in base64.
Is there a way of getting more debugging info back from Glide? I just get a 400 error and the following in the logs (which is what I am sending only). I have a column to write the response to - but that does not get completed. It is left blank.
It’s the exact same issue I raised in my first post in this thread, so am concerned it’s something to do with the way Glides call API handles these requests. Though other calls (mainly get) have worked nicely.
Any help much appreciated!
Andrew
Data sent by Glide to the API (with encoded attachment and Bearer truncated)
Thanks so much - can’t believe I missed that! That was exactly it - I had my Content Type in the Query String section…
Putting it into the Header section (and undoing all the other changes I’d made to try and trouble shoot!) and it worked.
Very quick question - Glide sends the values as a secret - so my content Type value - application/json - shows as “6c78bb96-3c76-4993-92f1-d3cb82988985”. Is that something that is done in the backend to keep it secret? Assume so
Thanks again for taking the time to read through my JSON and spotting the error. Much appreciated!