cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MartinHutchcpa
Helper III
Helper III

Xero Oauth2.0

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?

24 REPLIES 24

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. 

LukePWilkins
Helper I
Helper I

@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 

@LukePWilkins 

 

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.

 

Screen Shot 2021-06-11 at 8.50.46 am.png

 

Let me know if this helps.

LukePWilkins
Helper I
Helper I

I too have shifted my token and client details into a dataverse table. 
Loads cleaner and probably more efficient that a text file! 

 

cheers

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,586)