存取權杖

此端點允許您將短期Instagram 用戶存取權杖換成長期 Instagram 用戶存取權杖。

建立

不支援執行此作業。

讀取

GET /access_token

短期Instagram 用戶存取權杖換成長期 Instagram 用戶存取權杖。

限制

針對長期權杖的要求會包含您的應用程式密鑰,因此只能以伺服器端程式碼進行,切勿以用戶端程式碼進行,或是以可能被反編譯的應用程式二進位檔進行。請勿將您的應用程式密鑰與任何人分享、在程式碼中公開、傳送至用戶端或儲存在裝置中。

必備條件

要求語法

GET https://graph.instagram.com/access_token
  ?grant_type=ig_exchange_token
  &client_secret={instagram-app-secret}
  &access_token={short-lived-access-token}

查詢字串參數

加入下列查詢字串參數,以擴充要求。

索引鍵

client_secret
必要
字串

您的 Instagram 應用程式密鑰顯示在應用程式主控板 > 產品 > Instagram > 基本顯示 > Instagram 應用程式密鑰欄位。

grant_type
必要
字串

將此設為 ig_exchange_token

access_token
必要
字串

您要換成長期權杖的有效(未過期)短期 Instagram 用戶存取權杖。

回應

JSON 格式物件,包含下列屬性和值。

{ "access_token": "{access-token}", "token_type": "{token-type}", "expires_in": {expires-in} }

回應內容

值預留位置

{access-token}
數值字串

長期 Instagram 用戶存取權杖。

{token-type}
字串

bearer

{expires-in}
整數

長期權杖失效之前的秒數。

cURL 範例

要求

curl -X GET \ 'https://graph.instagram.com/access_token?grant_type=ig_exchange_token&&client_secret=eb87G...&access_token=IGQVJ...'

回應

{ "access_token": "lZAfb2dhVW...", "token_type": "bearer", "expires_in": 5183944 }

更新

不支援執行此作業。

刪除

不支援執行此作業。