In this tutorial we will see how to generate Instagram API access token so, that we can use it in our website to display feeds, comments and messages directly into our website without logging into account.
If you thinking about pulling the information of your instagram account e.g photos, videos or notifications of users information in your website, then you need to make use of instagram API to pull these data.
Today we are going to learn how to generate Instagram API access token so, that we can use it in our web application. Follow the steps below that is required to generated the Instagram API and access token.
Step 1 : Register an Application for Request of an API
Go to https://www.instagram.com/developer/
and press register your application at the bottom.
It will ask “what do you want to build with the API ?”, website URL and phone number. You can give any valid reasons like “I want to display real time feeds on my website” or anything you want and press signup.
After that press manage clients at the top right corner and press add new client to register new client. Now it will prompt you to register for new client ID and fill up the form.
Step 2 : Register new Client ID
In this step we are going to fill our details that is required to generate the client id and client secret and later we will use client id to generate the access token and use it in our website.
As you can see in the image below, you are asked to provide the details,
Application Name : can be any name you want (keep the name of website, will be helpful for future reference).
Description :- Gathering the photos and details of my account.
Company name : Website name.
Website URL : Website URL where you want to fetch the data.
Valid Redirect URLs : URL of the path where you want to display the information. (web page URL). If you are confused you can keep your website homepage as well.
Privacy policy : Privacy policy is the must page that you need in your website, to make believe Instagram see that your website is legit and has terms and policies. This builds up trust.
Contact Email : You can give any email you want.
One thing forgot to mention that, before registering make sure you go to security tab and untick disable implicit OAuth
.
Now verify yourself and press register.
After registration make a note of client ID and Valid Redirect URL (which will basically be your website URL or web page URL)
Step 3 : Generate Access Token
In this we are going to generate access token that is required for us to pull the data into our website.
Just hit this URL in the browser.
https://www.instagram.com/oauth/authorize/?client_id=Client-ID&redirect_uri=Valid_Redirect_URL/&response_type=token&scope=likes+comments
Where,
Client-ID and Valid_Redirect_URL will be the data that you obtain from step 2.
After hitting this URL, you are prompted with an authorization, just click authorize and you will be redirected to your website with an access token in the address bar like the image below.
This is the access token that we will require to use in our website. If you have any problem generating Instagram access token, make sure to mention them in comments or contact us via contact page.
Leave a Reply