将查询参数添加到Instagram auth redirect_uri不起作用? [英] Adding a query parameter to the Instagram auth redirect_uri doesn't work?

查看:105
本文介绍了将查询参数添加到Instagram auth redirect_uri不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 在客户端中注册一个redirect_uri: http://example.com/publisher/auth
  2. 使用带有查询参数的redirect_uri将用户定向到/oauth/authorize端点:
  1. Register a redirect_uri in the client: http://example.com/publisher/auth
  2. 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

  • 授权instagram用户并允许该应用.
  • 用户被重定向回到正确的redirect_uri.
  • 使用重定向的URI中的代码查询参数将其发布到Instagram的/oauth/access_token端点.
  • 预期行为

    端点以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屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆