John Tanner
John Tanner

Reputation: 71

Imgur API Authorization issues

I've been teaching myself how to use react and meteor and I'm following a course on Udemy. The first project we have to do requires the imgur gallery endpoint which is : https://api.imgur.com/3/gallery/hot/viral/0.json.

Obviously however I get the error saying "authorization required".

I am trying to complete the authorization that is here: https://apidocs.imgur.com/. However, at step 3, where I'm supposed to generate the new token, I get an error in the Postman Console saying:

{"data":{"error":"redirect_uri_mismatch","request":"/oauth2/authorize","method":"GET"},"success":false,"status":400}

Exactly what am I doing wrong?

I also uploaded a picture with the error I am getting in console. I am not sure if you need more or not as I am pretty clueless to what is going on so far. https://i.sstatic.net/IGZgp.png

Upvotes: 6

Views: 3190

Answers (4)

Rishab
Rishab

Reputation: 1957

For Postman 8.0.7

For field callback url there is an option to check which says Authorize using browser. When you check that the url becomes https://oauth.pstmn.io/v1/callback no matter what url you put before.

Copy that url and paste it as Olivp suggested. Now in postman click Get new Access Token. Your browser will open and ask you to allow the app to access your account. When you allow that a pop up will appear. That pop up will link back to postman. You are done.

Upvotes: 1

Olivp
Olivp

Reputation: 81

Imgur's documentations is not up-to-date.

When you are at the Get New Access Token step, go to https://imgur.com/account/settings/apps, click edit, and in the pop-up window, replace the Postman callback url by this one: https://oauth.pstmn.io/v1/browser-callback. Click update, and then Postman will work like a charm.

Upvotes: 8

Jason Ross
Jason Ross

Reputation: 81

I had this same issue. The problem was that the redirect for the Imgur application I registered did not match the callback URI I had configured in Postman.

When I registered the application with Imgur, I did not set a callback URI for the application in Imgur because I don't need one for the oauth2 flow I'm using, however Imgur automatically set up a redirect for it, to https://imgur.com.

Setting the Postman callback URL to match the Imgur redirect URL for my application resolved this error message.

You can view the redirect settings for your Imgur application at https://imgur.com/account/settings/apps, and change them as needed using the edit function there. Since your setup is working from the command line, you should be able to just copy whatever URL is currently there to your Postman callback configuration and it should work!

Upvotes: 8

Tokenyet
Tokenyet

Reputation: 4291

I have been stuck by this issue for a while ago, but finally pass through. What I actually do is change the callback Url in Postman to https://www.getpostman.com/oauth2/callback and click the Request Token button multi-times. And then receive the error redirect_uri_mismatch again and again...

Guess what, It finally passed It, so the only solution is waiting imgur for maybe 5 to 10 minutes to sync Its OAuth2.

Upvotes: 2

Related Questions