如何解决auth错误“redirectURI不匹配注册的redirectURI”在IOS?

我正在从我的iPhone应用程序的instagram开发者页面注册一个新的客户端。但我有problem.I创build客户端ID,但它给出了这个错误:

{“code”:400,“error_type”:“OAuthException”,“error_message”:“redirectURI与注册redirectURI不匹配”}

其实,我用ios代码连接这个链接:

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

所以,我find了示例客户端ID。当我尝试在此链接上采样客户端ID时:

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

它在相同的代码上运行良好。

但是当我创build客户端ID。它不工作。我检查了一个链接 。但是,我没有解决这个错误。

有人可以指导我如何生成一个新的客户端redirect? 或者我的问题是什么?

在这里输入图像说明 在Instagram注册您的应用程序(以生成client_id)。 你必须在那里设置redirect_uri。

请检查图像并像我一样进行configuration。

对于任何人有这个问题,并提供给instagram的redirecturi是完全一样的,你使用的是,我发现有些用户input我的url为http://www.example.com/login当在我的Instagram API中,它是http://example.com/login

然后,我创build了一个PHP脚本来检测stringwww存在于我的url,然后重新加载到相同的页面,但没有www

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