Redirect URI is invalid error

I was following the steps outlined in OAuth 2.0 authorization. While on step 3(exchanging authorization code for access token). I am getting the following error

Body : {"error":"invalid_grant","error_description":"Redirect URI is invalid"}

 

I did check the Errors page to look up the 'invalid_grant' error, I did not find any reference to it. I am unsure how to proceed further.

 

Any ideas?

 

0
8 comments
Spot On Innovative Approach Stellar Advice
Avatar

Hi Ajay, if there is more than one redirect URI in your app, you'd want to specify it as the fifth parameter in your call, just like in step one. If it's not the case here we'll be happy to open a Support ticket for you to troubleshoot this!

Sergey Community Team at Wrike Wrike Product Manager Become a Wrike expert with Wrike Discover

Sergey Wrike Team member Become a Wrike expert with Wrike Discover

2
Comment actions Permalink
Spot On Innovative Approach Stellar Advice
Avatar

Hi Sergey,

Thank you for looking into this. I solved this by using the permanent tokens. :D

 

Thanks,
Ajay

0
Comment actions Permalink
Spot On Innovative Approach Stellar Advice
Avatar

Good thinking! If you decide to return to OAuth 2 later - we'd be happy to talk about it :)

Sergey Community Team at Wrike Wrike Product Manager Become a Wrike expert with Wrike Discover

Sergey Wrike Team member Become a Wrike expert with Wrike Discover

0
Comment actions Permalink
Spot On Innovative Approach Stellar Advice
Avatar

Hello Sergey

I am having the exact same problem as our fellow above.

 

the query params I am sending are:

 

'query'    =>    [
    'client_id'        =>    $this->clientId,
    'client_secret'    => $this->secret,
    'grant_type'    =>    'authorization_code',
    'code'            =>    $request->code,
    'redirect_uri'    =>    'http://localhost:8000/wriketoken',

],

 probably the only thing I am doing in a different way, is that I am opening a new window to the authorization screen... when everything is done on the same window, it works like a charm

What am I doing wrong?

0
Comment actions Permalink
Spot On Innovative Approach Stellar Advice
Avatar

Hi Rafael! Sorry it took a while for us to reply. Have you managed to make it work? 

It appears strange, maybe you could check the actual calls you make (maybe through some listener like Fiddler) to see what is changing? What if you try with the permanent access token?

Pavel M Community Team at Wrike Wrike Product Manager Become a Wrike expert with Wrike Discover

Pavel M Wrike Team member Become a Wrike expert with Wrike Discover

0
Comment actions Permalink
Spot On Innovative Approach Stellar Advice
Avatar

I have the same problem.

The POST https://www.wrike.com/oauth2/token always fails with 400 - bad request error, both in Postman, and in my code:


{ "error": "invalid_grant", "error_description": "Redirect URI is invalid"}


I have only one redirect_uri specified in my app config, which is http://localhost:8000.

I tried to specify it for the previous request (https://www.wrike.com/oauth2/authorize/v4?client_id=<client_id>&response_type=code&redirect_ur= http://localhost:8000) AND also tried to add it as a parameter for https://www.wrike.com/oauth2/token.

This is still not working. I really don't know what i'm missing. The permanent token is working but this is not what i want.

0
Comment actions Permalink
Spot On Innovative Approach Stellar Advice
Avatar

I had this same issue. Even though I only have one Redirect URI in my app, started sending the redirect_uri parameter as Sergey suggested, and it worked.

0
Comment actions Permalink
Spot On Innovative Approach Stellar Advice
Avatar

Hi MA Lesellier, sorry for the delay here. 

Are you still having an issue? If so, let me know and we'll assist further 👍

Elaine Community Team at Wrike Wrike Product Manager Become a Wrike expert with Wrike Discover

Elaine Wrike Team member Become a Wrike expert with Wrike Discover

0
Comment actions Permalink

Folllowing List for Post: Redirect URI is invalid error
[this list is visible for admins and agents only]

Top
Didn’t find what you were looking for? Write new post