【问题标题】:Instagram API OauthException: "You must provide a client_id"Instagram API OauthException:“您必须提供 client_id”
【发布时间】:2014-08-31 18:16:29
【问题描述】:

当我尝试从 Instagram. 接收 access_token 时,我执行以下请求

params = {
    'client_id' : config.INSTAGRAM_APP_ID,
    'client_secret' : config.INSTAGRAM_APP_SECRET_KEY,
    'grant_type' : 'authorization_code',
    'redirect_uri' : '`my localhost`',
    'code' : code
    }
r = requests.post('https://api.instagram.com/oauth/access_token', params = params)

并收到错误:

{"code": 400, "error_type": "OAuthException", "error_message": "You must provide a client_id"}

我能用这些做什么?

【问题讨论】:

  • 你解决了这个问题吗?
  • 请问有人解决了吗

标签: python api instagram python-requests access-token


【解决方案1】:

我通过将这些参数放在 (x-www-form-encoded) body 而不是 header 中解决了这个问题(这个想法归功于 https://github.com/request/request/issues/983#issuecomment-57005849 )。

注意:我没有使用 python 包装器。

【讨论】:

  • 正确!使用 x-www-form-urlencoded 请求也适用于 Postman
【解决方案2】:

使用app_idapp_secret

对于邮递员,将正文参数放入x-www-form-urlencoded

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-08
    • 2014-02-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多