Get local Instagram api credentials with Ngrok

Submitted by christophe on Thu, 12/12/2019 - 17:57

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

     

  2. Start Ngrok and get the forwarding url
    (e.g. http://my.ngrok.io)
    ./ngrok http 8000

     

  3. Copy this url into the security tab from the Instagram ui
    Ngrok Instagram
  4. 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
     
  5. 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

 

Tags

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.