How to solve auth error "Redirect URI does not match registered Redirect URI" in IOS?

I am working on registering a new customer from the instagram developer page for my iphone app. But I have a problem. I created a client id but it gave this error:

{"code": 400, "error_type": "OAuthException", "error_message": "The redirect URI does not match the registered redirect URI"}

Actually, I used this link to connect in ios code:

https://instagram.com/oauth/authorize?response_type=token&redirect_uri=igd9fe475655e646cd8025bed7f8626230%3A%2F%2Fauthorize&scope=comments+likes&client_id=d9fe475655e646cd802307

So I found a sample client id. When I tried trying the client id from this link:

https://instagram.com/oauth/authorize/?response_type=token&redirect_uri=igfd725621c5e44198a5b8ad3f7a0ffa09%3A%2F%2Fauthorize&scope=comments+likes&client_id=fd719256215b5eff0

it works well on the same code.

But when ı created Client ID.It doesn't work. I have checked the link . But I haven't resolved this error.

Can anyone help me in creating a new client redirect? or What's my problem?

+1


source to share


2 answers


enter image description hereWhen registering your app with Instagram (to generate client_id). You have to set redirect_uri there.



Please check the image and adjust it like I did.

+4


source


For those who have this problem and the uri redirect provided by instagram is exactly the same as the one you are using, I found that some users were typing my website url like http://www.example.com/login

when it was in my instagram api http://example.com/login

.

Then I created a php script to determine if a string exists www

in my url and then reloads to the same page but without www

.



if(strpos($_SERVER['HTTP_HOST'], 'www.') !== FALSE) {
    header("Location: ".str_replace('www.', '', $_SERVER['HTTP_HOST'].'/'.$_SERVER['REQUEST_URI']));
}

      

0


source







All Articles