簡體   English   中英

Instagram API訂閱端點即使提供了訪問令牌也會要求訪問令牌

[英]Instagram API Subscription endpoint asks for access token even though it is provided

我正在向instagram API訂閱端點發送POST請求以添加用戶訂閱,但出現錯誤:

error: StatusCodeError: 400 - {"meta": {"code":400, "error_type":"OAuthParameterException", "error_message":"Missing client_id or access_token URL parameter."}}

我在請求中同時提供了client_idaccess_token

這是請求代碼。

let access_token = user[0].access_token
let options = {
        method: 'POST',
        uri: `https://api.instagram.com/v1/subscriptions/`,
        body: {
          access_token: access_token,
          client_id: instaConfig.client_id,
          client_secret: instaConfig.client_secret,
          object: 'user',
          aspect: 'media',
          verify_token: 'myVerifyToken',
          callback_url: `${callback_url}`
        },
        headers: {
          'User-Agent': 'Request-Promise'
        },
        // Automatically parses the JSON string in the response
        json: true
      }
// rp = require('request-promise')
      rp(options)
        .then((response) => {
          console.log('subscriptions response: ' + util.inspect(response, { showHidden: true, depth: null }))
        })
        .catch((err) => {
          console.log('error: ' + err)
        })

它不會從身體讀取。 它需要從查詢參數或標頭中傳遞。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM