MYOBCommunity
Partner Zone
|
|
Partner Zone

Invalid Request Error from ASP.NET C#

1 REPLY 1
Former Staff KeranM
299 Posts
Former Staff
Australia
KeranM
Former Staff

299Posts

94Kudos

56Solutions

Re: Invalid Request Error from ASP.NET C#

Hi there

 

Sorry to hear you are having this hiccup, but glad to hear it's working fine in Postman.

Because it's working fine in Postman we can rule out any issues with the API Key or Secret.

 

"Invalid_request" is a response usually given when the authentication server is not able to match the redirect_uri that you are passing it with the one stored when you registered for the keys.

 

1) Check that the redirect_uri you are POSTing is NOT urlencoded - because you will POST the data in the BODY as x-www-urlencoded, your server will urlencode this content on the way out. It's a common mistake that people think it needs to be encoded before being passed through (that just results in double encoding)

 

2) Check that the redirect_uri is exact - I've seen lots of posts and comments about how adding a "/" or removing the "/" has resolved the issue. If your redirect_uri has a "/" on the end when you registered it, then you will need the "/" on the end, otherwise you won't

 

3) Check for rogue spaces and extra characters in your code - make sure that when you pass the redirect_uri through your code you don't have an extra space or hidden character included

 

And with that - you should be good to go.

Again, because it works in Postman we know that everything is ready to go from an account and flow point of view, it's just this niggly redirect URI that you'll need to work through.

 

Hope that helps

Keran McKenzie
Futurist in residence @MYOB

Are you a developer? Check out http://developer.myob.com
Looking for an Add-on? Check out http://myob.com/addons/

Twitter: @myobapi | @keranm
Partner Chandru
2 Posts
Partner
Chandru
Partner

2Posts

0Kudos

0Solutions

Invalid Request Error from ASP.NET C#

Hi,

Can anyone helpme on this. I have created a sample ASP.NET application written in C# (Attached for your reference). i'm able to get the Access Code but during authorization, it fails with "invalid_request".

I have tried with same keys, redirect URLS in postman and it works, but in C#, it is failing.  Please refer "SynchronizeAccountController.cs" for my implemenattion

 

REgards,

Chandru. BK

Didn't find your answer here?
Try using advanced search to find a post more easily Advanced Search
or
Get the conversation started and make a new post Start a Post