Instagram recently change their API so it does not use client_id anymore but instead access_token.
I just want to get a list of instagram pictures that I have and put it on my website.
This is my previous ajax
call using jsonp
'https://api.instagram.com/v1/users/'+_instagram._id+'/media/recent/?client_id='+_instagram._clientId
How do I do it now with access_token
? I don't want a visitor of my website to log in into instagram everytime just to view my instagram pictures that will be available on my website
If I get your question correctly, you want to fetch your own recent media that you have posted on Instagram using the new API endpoints using an access token.
So, the solution to this is pretty simple. You don't need your visitors to log in their Instagram every time to view your media on Instagram.
Using Access Token(Using server side explicit method, preferred):
Request Access Code:
var redirect_uri = "&redirect_uri="<REDIRECT-URI>,
scope = "&scope=basic",
response_type = "&response_type=code",
url = "https://api.instagram.com/oauth/authorize/?client_id=" + <CLIENT-ID> + redirect_uri + response_type + scope;
Exchange CODE for token:
Extract the code from http://your-redirect-uri?code=CODE
and exchange this code to get the access token using server side method like cURL (preferred)
https://api.instagram.com/oauth/access_token
.Pass the following parameters,
Without Using Access Token(Using implicit method):
https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=token
http://your-redirect-uri#access_token=ACCESS-TOKEN
Fetch your published media:
Use endpoint as https://api.instagram.com/v1/users/self/media/recent/?access_token=<ACCESS-TOKEN>
(you can pass optional parameters like count if required)
Here your visitors don't need to log in their accounts. Once you have the link, save them in your database so you don't have to log in every time.
Hope it helps!