我尝试使用 Instagram 的 API 获取访问 token ,但遇到问题,我认为问题是由于重定向 URI 造成的。
我目前的重定向 uri 为:http://socialmediasnapshot.net
但是,用户正在从 http://socialmediasnapshot.net/Instagram.html 登录
我尝试输入上述地址作为重定向 uri,但它不起作用。有没有办法让用户可以从 HTML 页面进行身份验证?我正在使用以下代码:
$.ajax({
url: 'https://instagram.com/oauth/authorize/?client_id=' + client_id + '&redirect_uri=' + redirect_uri + '&response_type=token',
dataType: 'jsonp',
success: function(req) {
alert('yay')
alert(JSON.stringify(req))
},
error: function(req) {
alert('boo')
alert(JSON.stringify(req))
}
})
最佳答案
根据文档,
https://instagram.com/developer/authentication/
Note that the host and path components of your redirect URI must match exactly (including trailing slashes) your registered redirect_uri. You may also include additional query parameters in the supplied redirect_uri, if you need to vary your behavior dynamically
因此,如果您希望此功能正常工作,我认为您必须将注册的 URI 更改为 http://socialmediasnapshot.net/Instagram.html
关于javascript - Instagram API 重定向 uri,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31486958/