Integrate Instagram Without API + Drupal 8

#InstagramWithoutAPI

It's a very simple module that integrates without an API with Instagram and generates a block that contains your latest Instagram messages.

To submit bug reports and feature suggestions, or to track changes:
https://www.drupal.org/project/issues/instagram_without_api

Install as you would normally install a contributed Drupal module. See:
https://www.drupal.org/docs/8/extending-drupal/installing-contributed-modules
for further information.

To add Instagram Block to specific content region Go to Block Layout.
i.e Home-> Administration-> Structure-> Block layout.

You must also add the Instagram account user name as part of the block setup to pull posts.

MODULE URL: https://www.drupal.org/project/instagram_without_api

 

Steps to Instagram Authentication Code Generation

1 - Instagram Register Application: 
 To register a new app, visit https:/www.instagram.com/developer.

2 - Register New App Client:
  Go to Manage Clients, and hit 'Register a New Client' to register and access the API

3 - Copy & Save Client ID:
  Here you will soon need the Client ID to copy the Client ID.
  client_id=7ffab69n40ec4f829b81ad0e98701528

4 - Configure Client for Public Access:
 From the Manage Clients screen, click ' Edit ' on your app, then open the ' Security ' tab and uncheck the ' Disable Implicit OAuth ' as we would like to see our feed from the public. Additionally, open the ' Sandbox ' tab and confirm this app's ' admin '. 

5 - Use this API URL in a browser:
 You can use your browser's easy URL to capture your access token. Open your browser and paste the URL below, replace the string after ' client I d ' and before your previously saved Client ID, and press Enter to visit this URL:
  https://api.instagram.com/oauth/authorize/?client_id=7ffab69n40ec4f829b81ad0e98701528&redirect_uri=https://www.domainname.com&response_type=code&scope=public_content

6 - Get Code:
  Now, you're getting the code. Just save the code to be used in the future.
  https://www.domainname.com/?code=e568703545nd7878bfe398d1f4ak48bd

6 - Authorize it:
 Visiting the URL we made with the client ID will create an ' Authorize ' screen. At this stage, you are using your local server to simulate an API link and you will authorize it to view the Access Token reply. Click "Authorize"
  https://api.instagram.com/oauth/authorize/?client_id=7ffab69n40ec4f829b81ad0e98701528&redirect_uri=https://www.domainname.com&response_type=token

7 - Get Access token:
  data in the URL… right after '#access_token=' you can grab your public Access Token, which also has your ID in it.
  https://www.domainname.com/#access_token=75XXXXXX51.76fad699.21a171c8md89f26eaf35ef94bfa5a360
  The User ID is the first string of digits before the first point(.)
  user id: 75XXXXXX51
  Access_token=75XXXXXX51.76fad699.21a171c8md89f26eaf35ef94bfa5a360

 

Solution:

-> From my experience, the Instagram access token expires at random moments. Even though our access tokens do not indicate an expiration time, your software should manage the event that either the user revokes access, or Instagram expires the token after a certain period of time. If the token is no longer valid, the replies to the API will contain "error type= OAuthAccessTokenError." In this case, you will need to re-authenticate the user to get a fresh valid token.

-> Every moment we need to regenerate the Authentication token, authorize the Instagram account and put it on our live server. We don't understand that the Instagram access token's time interval expires.

-> We can retrieve the data using query I d &?a=1 procedure (returns user account data-first set-in JSON format 'https:/www.instagram.com/{user}/? a=1'). I mentioned that query I d is a continuous value. That implies it is always 17888483320059182. Query I d' is now static, just use it (at least unless Instagram changes it).

-> Take the Instagram media request InstagramWithoutAPI:
If Instagram has altered the way it provides this information, none of the above techniques will operate. So, I decided to get the Instagram image information from the https:/www.instagram.com/{user}/ route. This technique returns all user account associated pictures.

-> So we get the information from instagram without an API.  (https://www.drupal.org/project/instagram_without_api)

 

Tags

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
16 + 3 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.