This post is used to get recent feed from your Instagram account and show them in your website automatically. We retrieve the Instagram feed by calling the Instagram API from any server side language.
Getting Access Token from Instagram Developer site
- Login to instagram developer site- https://www.instagram.com/developer/
- At the top, click on ‘Manage clients’. Then Register a New Client.
- Enter the required details and Register. Once your account is successfully created, you should see the CLIENT ID and CLIENT SECRET. Make a note of these details, as they are used to make API request to Instagram to get the feeds.
- Then edit the client what we have created. Go to the Security tab and uncheck the ‘Disable implicit OAuth’ and update the client.
Once they are updated, use the below URL and get the access token. Put your client id and redirect URL what you have provided while creation in the URL below. URL: https://www.instagram.com/oauth/authorize/?clientid=PUTYOURCLIENTIDHERE&redirecturi=YOUR_REDIRECTURL&responsetype=token
You will be asked to authorize your App to use your Instagram account. Click on authorize.
Click on Authorize.
You will be redirected to your redirect URL with the Access token in the URL as shown below.
Make a note and save your Access token. Access token is specific to each user and it should be not be disclosed to anyone.NOTE: By default the app will be in Sandbox mode with some limited number of requests. For more details about Sandbox mode and its limitations, you can go through the Instagram documentation here. Ofcourse you can even continue in the Sandbox mode too.
Making API calls using Access Token to get recent feed – Embedding Instagram feed
Using the access token you can make API calls to get your recent media posts as shown below.
Request URL: https://api.instagram.com/v1/users/self/media/recent/?accesstoken=PUTYOURACCESSTOKEN_HERE
I hope you found this useful. So please do SHARE!