How to insert instagram profile?

I have found literally hundreds of ways to embed the instagram gallery on a website, but I need to include the entire profile, i.e. if you look at this profile, for example: https://www.instagram.com/exampleprofile/ there is a profile picture, about, name and follow button.

How can I embed a profile with this header information, and not just images in my gallery? Is it possible?

+6
source share
2 answers

The right way to do this is to use the API. You can get information about users with this endpoint:

https://www.instagram.com/developer/endpoints/users/#get_users

+1
source

In fact, there is no easy way to do this, you need:

  • Create Instagram Client Application

  • Get customer information

  • Authenticate

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://your-redirect-uri?code=YOU-NEED-THIS-CODE 

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://api.instagram.com/oauth/access_token 

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://api.instagram.com/oauth/authorize/?client_id=[your client id]&redirect_uri=[your redirect uri]&response_type=token 

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/#access_token=xxxxxxxxxx.yyyyyyy.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz 

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

+1
source

All Articles