How to generate an instagram access token

Instagram recently made some changes to its API where new apps will require an access_token. If you plan on using the API without requiring users to auth, you can still easily get the token so you can make API calls. Just following the steps below.

Step 1 - Register for a developer account

If you don't already have one - https://www.instagram.com/developer/register/

Step 2 - Register a new client

If you haven't already, register here. Fill in the all the fields. If you're not familiar with oauth (learn!), you may be a little confused with the Valid redirect URIs field. Just enter any random url for your website, it need not exist, for example, http://www.mywebsite.com/auth/instagram. We will use this shortly to get our code parameter.

Step 3 - Get your code parameter

In your browser load the following url: https://www.instagram.com/oauth/authorize/?client_id=YOUR_CLIENT_ID_GOES_HERE &redirect_uri=THAT_REDIRECT_URI_YOU_GAVE&response_type=code

So it should look something like: https://www.instagram.com/oauth/authorize/?client_id=kljsdkjdkfkslsdkflslkds& redirect_uri=http://www.mywebsite.com/auth/instagram&response_type=code

After loading it, check the current url in the browser as you've been redirected! You should see something like

http://www.mywebsite.com/redirect/instagram?code=093485344lk399434t34

Nice, we have our code.

Step 4 - Request the access token

Load up a terminal and enter the following command with your creds (text in Caps):

curl -F 'client_id=CLIENT_ID' \ -F 'client_secret=CLIENT_SECRET' \ -F 'grant_type=authorization_code' \ -F 'redirect_uri=AUTHORIZATION_REDIRECT_URI' \ -F 'code=CODE' \ https://api.instagram.com/oauth/access_token

And Boom Goes the Dynamite. You should get a response like so:

{"access_token":"232339393.fjsddkdfjdsfjsdfkl.33333",.....

If you run into any issues, feel free to comment below. \m/.

Questions, comments, improvements?