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
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos
Комментариев: 10
Avatar
Sergey

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!

2
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

Hi Sergey,

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

 

Thanks,
Ajay

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos
Avatar
Sergey

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

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

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
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos
Avatar
Pavel M

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?

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

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
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

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

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

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 Узнайте о самых популярных функциях Wrike и советах по его использованию

Elaine Wrike Team member Узнайте о самых популярных функциях Wrike и советах по его использованию

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

Hi Mariappan S, welcome to the Community! 🤗

I can see that you're discussing this with our Support team currently. Please let me know if I can help you with anything else 👍

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

Lisa Wrike Team member Become a Wrike expert with Wrike Discover

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

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

Вверх
Didn’t find what you were looking for? Write new post