Colorfield logo

Drupalicious

Published on

Get local Instagram api credentials with ngrok

Authors
ngrok logo

It can be long to find the way through the documentation for these simple steps, so here is a shortcut.
Go to https://www.instagram.com/developer/clients/manage/ and get a Client ID and Client Secret.

  1. Start a local server
php -S localhost:8000
  1. Start Ngrok and get the forwarding url
    (e.g. http://my.ngrok.io)
./ngrok http 8000
  1. Copy this url into the security tab from the Instagram ui

    Ngrok Instagram
  2. Get the code
    Access this url from the browser:
    https://www.instagram.com/oauth/authorize/?client\_id=CLIENT-ID&redirect\_uri=http://my.ngrok.io&response\_type=code
    it will redirect then to http://my.ngrok.io/?code=CODE

  3. Get the access token

curl -F 'client_id=CLIENT-ID' \
-F 'client_secret=CLIENT-SECRET' \
-F 'grant_type=authorization_code' \
-F 'redirect_uri=http://my.ngrok.io' \
-F 'code=CODE' \
https://api.instagram.com/oauth/access_token

Documentation