Instagram is one of the most popular network for image sharing even more than a Facebook. Now in this post i am going to create a simple application in which i am going to use Instagram API to login and load my images from my wall. For this post i am using PHP and Angular to load and show image.

Demo

Step 1. Go to Instagram Developer website and login.

Step 2. Now go to Manage client link on top right side of header bar

Instagram integration on website

and click on link and create a new client add your details like your website url or callback url

Instagram image loading on website

Step 3. Now once you get your Client ID and Secret your ready to start. Add below code in your browser and hit enter to get code:

https://api.instagram.com/oauth/authorize/?client_id=<your_client_id>&redirect_uri=http://localhost:8080/instagram/&response_type=code

Note: If you want to other info like: public_content, follower_list, comments, likes etc you can add scope variable in above url eg: AboveURL&scope=likes+public_content

Also replace your callback url with your once. After ruining this url on browser you need to allow your app to access your data after this you get code and redirect back to callback url

http://localhost:8080/instagram/?code=9e2d1937038e431695a4d802bf981dc2

Step 4. Now we need to retrieve Access token from Instagram to load images.  We have two option here if you just want to load only your images like i am doing in this post you also use REST Client to request to get access token as show image bellow

Request instagram to get access token

or else you can request using PHP CURL like this

After you run this code or hit send button on your rest client you get your access token with other details like this.

Now you have your access token you can move forward to load images. Now we can load image and display

In above code i am using PHP CURl to load data and using angular and bootstrap to display images. This is very basic and simple post to load image from Instagram hope this help you 🙂