将查询参数添加到Instagram auth redirect_uri不起作用? [英] Adding a query parameter to the Instagram auth redirect_uri doesn't work?
问题描述
- 在客户端中注册一个redirect_uri: http://example.com/publisher/auth
- 使用带有查询参数的redirect_uri将用户定向到/oauth/authorize端点:
- Register a redirect_uri in the client: http://example.com/publisher/auth
- Direct a user to the /oauth/authorize endpoint with the redirect_uri including a query parameter:
https://api.instagram.com/oauth/authorize/?client_id=xxx&redirect_uri=http%3A%2F%2Fexample.com%2Fpublisher%2Fauth%3FinviteId%3D00001000-cf33-11e4-9f26-8789dd0b3e01&response_type=code&scope=basic&type=web_server
作为参考,这些查询参数为:
For reference, those query parameters are:
client_id=xxx
redirect_uri=http%3A%2F%2Fexample.com%2Fpublisher%2Fauth%3FinviteId%3D00001000-cf33-11e4-9f26-8789dd0b3e01
response_type=code
scope=basic
type=web_server
预期行为
端点以200和访问令牌作为响应.
Expected behavior
The endpoint responds with 200 and an access token.
端点响应:
code=400
error_type = 'OAuthException'
error_message = 'Redirect URI doesn't match original redirect URI'
到目前为止我调查的内容
为确认这是Instagram的问题,我检查了 API文档,其中非常清楚指出应该可以向重定向URI添加查询参数.我还尝试仅更改该查询参数.例如,当用此/oauth/authorize URL替换时,我得到了预期的行为:
What I've Investigated So Far
To confirm that this is a problem with Instagram, I checked the API docs which very clearly state that adding query parameters to the redirect URI should be possible. I also tried varying only that query parameter. For example, when replaced with this /oauth/authorize URL I get the expected behavior:
https://api.instagram.com/oauth/authorize/?type=web_server&client_id=xxx&redirect_uri=http%3A%2F%2Fexample.com%2Fpublisher%2Fauth&response_type=code&scope=basic
作为参考,这些查询参数为:
For reference, those query parameters are:
client_id=xxx
redirect_uri=http%3A%2F%2Fexample.com%2Fpublisher%2Fauth
response_type=code
scope=basic
type=web_server
注释
此问题实际上是另一个问题的重复项其实并没有真正成为一个问题,也从未得到任何答案.
Notes
This question is actually a duplicate of another question which actually didn't really turn out to be a question, and which never got any answers.
我已经在Instagram上提交了一个错误,但我想看看是否有人找到了这个错误或想出一种解决方法.
I have submitted a bug with Instagram, but I wanted to see if anyone had found this or come up with a workaround.
推荐答案
今天有同样的问题.要获取在请求之间传递的自定义数据,您必须将其作为state
参数包含在内.我的授权请求网址看起来像这样:
Had the same issue today. To get the custom data passed between requests you must include it as state
param. My authorize request url looked something like this:
Notice the & and state=...
这篇关于将查询参数添加到Instagram auth redirect_uri不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!