In fact, there is no easy way to do this, you need:
1. Creating an Instagram client application
You need to create your own instagram application here :
2. Get customer information
In the Instagram developer account, click "Client Management" and pay attention to "Client Identifier", "Client Secrecy" and "URI Redirection", because you will need them in the near future. Make sure you use the full URL for your redirect URI, such as " https://drupal.org ".
3. Authenticate
3.a Using CURL First add this to your browser:
https://api.instagram.com/oauth/authorize/?client_id=YOUR-CLIENT-ID&redirect_uri=YOUR REDIRECT-URI & response_type = code & scope = public_content Note that the REDIRECT-URI above must be encoded in a URL, for example https% 3A% 2F% 2Fdrupal.org.
Then you are redirected to the redirected URL. Pay attention to the URL, since here you get the code you need:
http:
Now open your terminal and paste it (add your identifier, secret, uri redirection and code):
curl -F 'client_id=YOUR CLIENT_ID HERE' \ -F 'client_secret=YOUR CLIENT_SECRET HERE' \ -F 'grant_type=authorization_code' \ -F 'redirect_uri=YOUR AUTHORIZATION_REDIRECT_URI HERE' \ -F 'code=THE CODE YOU RECEIVED' \ https:
You should get something similar to this:
{ "access_token": "fb2e77d.47a0479900504cb3ab4a1f626d174d2d", "user": { "id": "1574083", "username": "snoopdogg", "full_name": "Snoop Dogg", "profile_picture": "..." } }
3.b Using a browser Create the following URL and paste it into your browser:
https:
You may see the following error: "Implicit authentication is disabled." If this is the case, then you need to edit your Instagram Client, go to the "Security" tab and disable the Disable Implicit OAuth option, you can enable it as soon as you go to the next item.
If all goes well, you should be redirected to a URI that looks like this:
https://my_redirect.uri/
In the access_token key, the "x" part (all up to the first period) is your user ID.
4. Create a request for the Instagram API and then parse the response object
https://api.instagram.com/v1/users/xxxxxxxxxx/media/recent/?access_token=xxxxxxxxxx.yyyyyyy.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
Instagram API: https://www.instagram.com/developer/endpoints/users/#get_users
Source: https://www.drupal.org/node/2746185