Xero released their Oauth2.0 authenticated access to their API recently.
I am trying to write some flows to use this.
If I use Postman to generate the access code and then use it in flow, all works fine.
However the code needs to be refreshed every 30 minutes.
Running the token refresh call in Postman works fine, however it fails in Flow. "error": "unsupported_grant_type"
Post to https://identity.xero.com/connect/token
Header
"Authorization": "Basic Rjd..." - valid (checked) token
"Content-Type": "application/x-www-form-urlencoded"
The body of the http call is :-
{
"grant_type":"refresh_token",
"refresh_token":"0134e4a53c...",
"client_id":"F7B7...",
"client_secret":"GEfl..."
}
Can anyone shed any light on this please?
As it turns out yes. Yes I do have a typo! 🙂
Obviously because we this duplicated in the body (with correct spelling) this was not causing any issues but I have fixed it now in the header also.
Good to know there is at least more than one of us!! Should definitely share some learnings. I have created a maintenance records PowerApp that then creates invoices with multiple line item in Xero. It is going to save a lot of data entry time.
Absolutely. You have all of the encryption benefits and it is very easy to configure. Reach out if you have any issues but I don't expect that you will.
@Nebulas, this should probably go in a new thread, but i'll ask anyway!
I have my data in the dataverse in a newly created table. I can perform a Get Row, and filter down to the actual row and information I need. The output of Get Row is in JSON and I could parse the output.
If I wanted to retrieve just one of the columns value, for that row, what are the next steps?
Is it
PARSE JSON output of get row
initialize variable for the particular column and value
use the variable as needed?
some guidence would be tops.
I see to run into PA wanting to wrap everything in a for each loop
cheers
If you are using the 'Get Row by ID' dataverse connector then you shouldn't need to parse the JSON at all. You can simply then add an action after you 'Get Row by ID' for your 'HTTP' call and form the response from the dynamic content of the record retrieved in the output from 'Get Row by ID'. See my example from earlier post above.
If you wanted to stick with parsing first you could add a 'Select' action from Data Operation and then add the fields to the map. The first column is just a name you give it, then the second column add the value of the field from the output of your parse. But this is somewhat redundant due to my point above.
Here is a screenshot of my flow. The do until is simply until 'Status code' from the HTTP output is equal to 200. Note also that the two initialise variables are redundant also and were there for debugging to I could see the values being initialised.
Let me know if this helps.
I too have shifted my token and client details into a dataverse table.
Loads cleaner and probably more efficient that a text file!
cheers
Hi Martin, I am going through this post and it seems like you have accessed Xero API using MS Flow, from your comment I have understood that the initial authentication for Xero, which requires us to enter the email password for Xero cannot be done through the flow and I need to use Postman only to get that done?
Yes, authenticate in Postman. Save the values to data store (I used sharepoint) then use these to refresh the token every 15 mins I think.
Great thanks a lot for getting back!
Thank you so much for this - that has saved me a LOT of time!