Instagram api oauth 405 不允许
Instagram api oauth 405 not allowed
我正在尝试将 instagram api 与 postman
一起使用。
我做了一个 post 请求:
https://api.instagram.com/oauth/access_token
client_id : "client_id"
client_secret : "client_secret"
grant_type : authorization_code
redirect_uri : "redirect_uri"
code : "code"
结果是:405 METHOD NOT ALLOWED
我该怎么做才能得到正确的回应?
据我所知,这是不正确的。我们使用 POST 到此端点的生产应用程序在大约 15 分钟前才开始出现故障。我尝试发出 GET 无济于事。响应中的 'Allow' header 确实说 POST,所以我认为这是我们打算做的,但似乎有问题。
这是因为 302 重定向来自命中 "api.instagram.com"。
您应该使用以下网址:
/**
* {@inheritdoc}
*/
protected function getAuthUrl($state)
{
return $this->buildAuthUrlFromBase(
'https://instagram.com/oauth/authorize', $state
);
}
/**
* {@inheritdoc}
*/
protected function getTokenUrl()
{
return 'https://instagram.com/oauth/access_token';
}
代码取自为 Laravel 覆盖我的 Instagram Socialite 插件。 (socialiteproviders.github.io/providers/instagram/)
有这个问题,这是由于从 api.instagram.com 重定向到 instagram.com。我们从 url 的开头删除了 "api."(所以 https://instagram.com/oauth/access_token),它又开始工作了。
您尝试哪个端点可能并不重要
https://api.instagram.com/oauth/access_token 将您重定向到
https://instagram.com/oauth/access_token
要么
https://instagram.com/oauth/access_token
Endpoint 仅允许您用于 POST 请求,但由于某些原因它无法正常工作。我有类似的问题,我使用方法 POST 很长一段时间,现在它也不起作用。这看起来像是一些 Instagram API 问题。
现在似乎工作正常。很可能是暂时的 Instagram 内部问题。 Instagram deleveloper 的博客没有任何报道。
我在使用 Django==1.7.8
和 django-allauth==0.24.1
时 运行 遇到了这个问题。我通过更改 access_token_url
和 authorize_url
来使用 api.instagram.com
子域而不是 instagram.com
.
来修复它
我正在尝试将 instagram api 与 postman
一起使用。
我做了一个 post 请求:
https://api.instagram.com/oauth/access_token
client_id : "client_id"
client_secret : "client_secret"
grant_type : authorization_code
redirect_uri : "redirect_uri"
code : "code"
结果是:405 METHOD NOT ALLOWED
我该怎么做才能得到正确的回应?
据我所知,这是不正确的。我们使用 POST 到此端点的生产应用程序在大约 15 分钟前才开始出现故障。我尝试发出 GET 无济于事。响应中的 'Allow' header 确实说 POST,所以我认为这是我们打算做的,但似乎有问题。
这是因为 302 重定向来自命中 "api.instagram.com"。
您应该使用以下网址:
/**
* {@inheritdoc}
*/
protected function getAuthUrl($state)
{
return $this->buildAuthUrlFromBase(
'https://instagram.com/oauth/authorize', $state
);
}
/**
* {@inheritdoc}
*/
protected function getTokenUrl()
{
return 'https://instagram.com/oauth/access_token';
}
代码取自为 Laravel 覆盖我的 Instagram Socialite 插件。 (socialiteproviders.github.io/providers/instagram/)
有这个问题,这是由于从 api.instagram.com 重定向到 instagram.com。我们从 url 的开头删除了 "api."(所以 https://instagram.com/oauth/access_token),它又开始工作了。
您尝试哪个端点可能并不重要
https://api.instagram.com/oauth/access_token 将您重定向到 https://instagram.com/oauth/access_token 要么 https://instagram.com/oauth/access_token
Endpoint 仅允许您用于 POST 请求,但由于某些原因它无法正常工作。我有类似的问题,我使用方法 POST 很长一段时间,现在它也不起作用。这看起来像是一些 Instagram API 问题。
现在似乎工作正常。很可能是暂时的 Instagram 内部问题。 Instagram deleveloper 的博客没有任何报道。
我在使用 Django==1.7.8
和 django-allauth==0.24.1
时 运行 遇到了这个问题。我通过更改 access_token_url
和 authorize_url
来使用 api.instagram.com
子域而不是 instagram.com
.