How to get an Instagram Access Token

Gerry Mckay picture Gerry Mckay · May 11, 2013 · Viewed 244.2k times · Source

I'm really struggling in how I'm meant to get my access token for Instagram,

I've registered a new client and then I used this URL

https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=code

to fill in the clients ID and redirect Url.

I then was redirected to a page where it displayed a code in the Url but from there I don't have a clue where id then get my access token.

Answer

Marek Jalovec picture Marek Jalovec · Feb 17, 2015

Link to oficial API documentation is http://instagram.com/developer/authentication/

Longstory short - two steps:

Get CODE

Open https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=code with information from http://instagram.com/developer/clients/manage/

Get access token

curl \-F 'client_id=CLIENT-ID' \
    -F 'client_secret=CLIENT-SECRET' \
    -F 'grant_type=authorization_code' \
    -F 'redirect_uri=YOUR-REDIRECT-URI' \
    -F 'code=CODE' \
    https://api.instagram.com/oauth/access_token