OAuth2 Trouble with Redirect URL { error: 'invalid_grant', error_description: 'Redirect URI is invalid' }


While following the steps outlined in the OAuth 2.0 authorization documentation, I am receiving the following error in Step 3 (Exchanging authorization code for access token): 

data: {
    error: 'invalid_grant',
    error_description: 'Redirect URI is invalid'

What I've done so far: 

  1. Ensured that my request URL is free of syntactical errors: "https://login.wrike.com/oauth2/authorize/v4?client_id=${process.env.WRIKE_OAUTH2_CLIENT_ID}&response_type=code&redirect_uri=${process.env.WRIKE_OAUTH2_REDIRECT_URI}"
  2. The WRIKE_OAUTH2_REDIRECT_URI value above resolves to "https://localhost:3000/auth/wrike/callback" which I have also entered in the API > API Apps configuration screen without any spelling errors
  3. I originally did not have "https" on localhost, I was using "http". However, I read the paragraph under the "Redirect URI*" section on the app configuration page that says "Provide one or more redirect URIs. Redirect URI should comply with OAuth2 standard requirements and utilize HTTPS protocol. Use “https://localhost” for local development." and updated my local environment to use https accordingly

I attempted to use the permanent access token just to test a few things until I'm able to resolve the error above, and even using the permanent token is resulting in the following error:

data: {
    errorDescription: 'Authorization method unknown',
    error: 'not_authorized'

For the permanent token, I am using a header that looks like: "Authorization: bearer [TOKEN]"

Any help would be greatly appreciated!

1 comment
Spot On Innovative Approach Stellar Advice

Hey Matthew Volk, our Support team have been in touch on this and will be happy to assist further. 

If you need anything else let me know 👍

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

Comment actions Permalink

Folllowing List for Post: OAuth2 Trouble with Redirect URL { error: 'invalid_grant', error_description: 'Redirect URI is invalid' }
[this list is visible for admins and agents only]

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