diff --git a/config/schema/social_auth_instagram.schema.yml b/config/schema/social_auth_instagram.schema.yml
index 04207a1..aa030e2 100644
--- a/config/schema/social_auth_instagram.schema.yml
+++ b/config/schema/social_auth_instagram.schema.yml
@@ -8,3 +8,9 @@ social_auth_instagram.settings:
     client_secret:
       type: string
       label: 'Client Secret'
+    scopes:
+      type: string
+      label: 'Scopes to be requested'
+    endpoints:
+      type: string
+      label: 'API Endpoints to be requested'
diff --git a/social_auth_instagram.install b/social_auth_instagram.install
index f1d0ca2..fc67409 100644
--- a/social_auth_instagram.install
+++ b/social_auth_instagram.install
@@ -43,3 +43,16 @@ function social_auth_instagram_install() {
 function social_auth_instagram_uninstall() {
   SocialAuthController::deleteLoginButtonSettings('social_auth_instagram');
 }
+
+/**
+ * Implements hook_update_N().
+ *
+ * The key api_calls was changed to endpoints. This update copies the values
+ * in 'api_calls' to 'endpoints'.
+ */
+function social_auth_instagram_update_8201(&$sandbox) {
+  $config = \Drupal::configFactory()->getEditable('social_auth_instagram.settings');
+  $endpoints = $config->get('api_calls');
+
+  $config->set('endpoints', $endpoints)->save();
+}
diff --git a/social_auth_instagram.services.yml b/social_auth_instagram.services.yml
index 09fba9a..f751aa9 100644
--- a/social_auth_instagram.services.yml
+++ b/social_auth_instagram.services.yml
@@ -2,8 +2,4 @@ services:
   social_auth_instagram.manager:
     class: Drupal\social_auth_instagram\InstagramAuthManager
     arguments:
-      - '@logger.factory'
-      - '@event_dispatcher'
-      - '@entity_field.manager'
-      - '@url_generator.non_bubbling'
       - '@config.factory'
diff --git a/src/Controller/InstagramAuthController.php b/src/Controller/InstagramAuthController.php
index 5a5403c..b3c55d3 100644
--- a/src/Controller/InstagramAuthController.php
+++ b/src/Controller/InstagramAuthController.php
@@ -124,9 +124,7 @@ class InstagramAuthController extends ControllerBase {
     $this->instagramManager->setClient($instagram);
 
     // Generates the URL where the user will be redirected for Instagram login.
-    // If the user did not have email permission granted on previous attempt,
-    // we use the re-request URL requesting only the email address.
-    $instagram_login_url = $this->instagramManager->getInstagramLoginUrl();
+    $instagram_login_url = $this->instagramManager->getAuthorizationUrl();
 
     $state = $this->instagramManager->getState();
 
@@ -141,7 +139,8 @@ class InstagramAuthController extends ControllerBase {
    * Instagram returns the user here after user has authenticated in Instagram.
    */
   public function callback() {
-    // Checks if user cancel login via Instagram.
+
+    // Checks if user cancel login.
     $error = $this->request->getCurrentRequest()->get('error');
     if ($error == 'access_denied') {
       drupal_set_message($this->t('You could not be authenticated.'), 'error');
@@ -167,11 +166,11 @@ class InstagramAuthController extends ControllerBase {
       return $this->redirect('user.login');
     }
 
+    $this->instagramManager->setClient($instagram)->authenticate();
+
     // Saves access token to session.
     $this->dataHandler->set('access_token', $this->instagramManager->getAccessToken());
 
-    $this->instagramManager->setClient($instagram)->authenticate();
-
     // Gets user's info from Instagram API.
     /* @var \League\OAuth2\Client\Provider\InstagramResourceOwner $instagram_profile */
     if (!$instagram_profile = $this->instagramManager->getUserInfo()) {
@@ -179,22 +178,10 @@ class InstagramAuthController extends ControllerBase {
       return $this->redirect('user.login');
     }
 
-    // Store the data mapped with data points define is
-    // social_auth_instagram settings.
-    $data = [];
-
-    if (!$this->userManager->checkIfUserExists($instagram_profile->getId())) {
-      $api_calls = explode(PHP_EOL, $this->instagramManager->getAPICalls());
-
-      // Iterate through api calls define in settings and try to retrieve them.
-      foreach ($api_calls as $api_call) {
-        $call = $this->instagramManager->getExtraDetails($api_call, $instagram_profile->getId());
-        array_push($data, $call);
-      }
-    }
+    $data = $this->userManager->checkIfUserExists($instagram_profile->getId()) ? NULL : $this->instagramManager->getExtraDetails();
 
     // If user information could be retrieved.
-    return $this->userManager->authenticateUser($instagram_profile->getName(), '', $instagram_profile->getId(), $this->instagramManager->getAccessToken(), $instagram_profile->getImageurl(), json_encode($data));
+    return $this->userManager->authenticateUser($instagram_profile->getName(), '', $instagram_profile->getId(), $this->instagramManager->getAccessToken(), $instagram_profile->getImageurl(), $data);
 
   }
 
diff --git a/src/Form/InstagramAuthSettingsForm.php b/src/Form/InstagramAuthSettingsForm.php
index b676bc2..5f5a77e 100644
--- a/src/Form/InstagramAuthSettingsForm.php
+++ b/src/Form/InstagramAuthSettingsForm.php
@@ -107,26 +107,30 @@ class InstagramAuthSettingsForm extends SocialAuthSettingsForm {
       '#default_value' => $GLOBALS['base_url'] . '/user/login/instagram/callback',
     ];
 
-    $form['instagram_settings']['authorized_javascript_origin'] = [
-      '#type' => 'textfield',
-      '#disabled' => TRUE,
-      '#title' => $this->t('Authorized Javascript Origin'),
-      '#description' => $this->t('Copy this value to <em>Authorized Javascript Origins</em> field of your Instagram App settings.'),
-      '#default_value' => $this->requestContext->getHost(),
+    $form['instagram_settings']['advanced'] = [
+      '#type' => 'details',
+      '#title' => $this->t('Advanced settings'),
+      '#open' => FALSE,
     ];
 
-    $form['instagram_settings']['scopes'] = [
+    $form['instagram_settings']['advanced']['scopes'] = [
       '#type' => 'textarea',
-      '#title' => $this->t('Scopes for API call'),
+      '#title' => $this->t('Scopes'),
       '#default_value' => $config->get('scopes'),
-      '#description' => $this->t('Define the requested scopes to make API calls.'),
+      '#description' => $this->t('Define any additional scopes to be requested, separated by a comma (e.g.: comments,likes).<br>
+                                  The scope \'basic\' is added by default and always requested.<br>
+                                  You can see the full list of valid scopes and their description <a href="@scopes">here</a>.', ['@scopes' => 'https://www.instagram.com/developer/authorization/']),
     ];
 
-    $form['instagram_settings']['api_calls'] = [
+    $form['instagram_settings']['advanced']['endpoints'] = [
       '#type' => 'textarea',
-      '#title' => $this->t('API calls to be made to collect data'),
-      '#default_value' => $config->get('api_calls'),
-      '#description' => $this->t('Define the API calls which will retrieve data from provider.'),
+      '#title' => $this->t('Endpoints'),
+      '#default_value' => $config->get('endpoints'),
+      '#description' => $this->t('Define the Endpoints to be requested when user authenticates with Instagram for the first time<br>
+                                  Enter each endpoint in different lines in the format <em>endpoint</em>|<em>name_of_endpoint</em>.<br>
+                                  <b>For instance:</b><br>
+                                  /users/self/media/recent|media_recent<br>
+                                  /users/self/media/liked|media_liked'),
     ];
 
     return parent::buildForm($form, $form_state);
@@ -141,7 +145,7 @@ class InstagramAuthSettingsForm extends SocialAuthSettingsForm {
       ->set('client_id', $values['client_id'])
       ->set('client_secret', $values['client_secret'])
       ->set('scopes', $values['scopes'])
-      ->set('api_calls', $values['api_calls'])
+      ->set('endpoints', $values['endpoints'])
       ->save();
 
     parent::submitForm($form, $form_state);
diff --git a/src/InstagramAuthManager.php b/src/InstagramAuthManager.php
index 5a128e1..10298c5 100644
--- a/src/InstagramAuthManager.php
+++ b/src/InstagramAuthManager.php
@@ -4,214 +4,101 @@ namespace Drupal\social_auth_instagram;
 
 use Drupal\social_auth\AuthManager\OAuth2Manager;
 use Drupal\Core\Config\ConfigFactory;
-use Drupal\Core\Logger\LoggerChannelFactoryInterface;
-use Drupal\Core\Entity\EntityFieldManagerInterface;
-use Drupal\Core\Routing\UrlGeneratorInterface;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
- * Contains all the logic for Instagram login integration.
+ * Contains all the logic for Instagram OAuth2 authentication.
  */
 class InstagramAuthManager extends OAuth2Manager {
 
-  /**
-   * The logger channel.
-   *
-   * @var \Drupal\Core\Logger\LoggerChannelFactoryInterface
-   */
-  protected $loggerFactory;
-
-  /**
-   * The event dispatcher.
-   *
-   * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
-   */
-  protected $eventDispatcher;
-
-  /**
-   * The entity field manager.
-   *
-   * @var \Drupal\Core\Entity\EntityFieldManagerInterface
-   */
-  protected $entityFieldManager;
-
-  /**
-   * The url generator.
-   *
-   * @var \Drupal\Core\Routing\UrlGeneratorInterface
-   */
-  protected $urlGenerator;
-
-  /**
-   * The Instagram client object.
-   *
-   * @var \League\OAuth2\Client\Provider\Instagram
-   */
-  protected $client;
-  /**
-   * The Instagram access token.
-   *
-   * @var \League\OAuth2\Client\Token\AccessToken
-   */
-  protected $token;
-
-  /**
-   * The Instagram user.
-   *
-   * @var \League\OAuth2\Client\Provider\InstagramUser
-   */
-  protected $user;
-
-  /**
-   * The data point to be collected.
-   *
-   * @var string
-   */
-  protected $scopes;
-
-  /**
-   * Social Auth Instagram Settings.
-   *
-   * @var array
-   */
-  protected $settings;
-
-
   /**
    * Constructor.
    *
-   * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_factory
-   *   Used for logging errors.
-   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
-   *   Used for dispatching events to other modules.
-   * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
-   *   Used for accessing Drupal user picture preferences.
-   * @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator
-   *   Used for generating absoulute URLs.
    * @param \Drupal\Core\Config\ConfigFactory $configFactory
-   *   Used for accessing configuration object factory.
+   *   Used for accessing Social Auth Instagram settings.
    */
-  public function __construct(LoggerChannelFactoryInterface $logger_factory, EventDispatcherInterface $event_dispatcher, EntityFieldManagerInterface $entity_field_manager, UrlGeneratorInterface $url_generator, ConfigFactory $configFactory) {
-    $this->loggerFactory      = $logger_factory;
-    $this->eventDispatcher    = $event_dispatcher;
-    $this->entityFieldManager = $entity_field_manager;
-    $this->urlGenerator       = $url_generator;
-    $this->config             = $configFactory->getEditable('social_auth_instagram.settings');
+  public function __construct(ConfigFactory $configFactory) {
+    parent::__construct($configFactory->get('social_auth_instagram.settings'));
   }
 
   /**
-   * Authenticates the users by using the access token.
-   *
-   * @return $this
-   *   The current object.
+   * {@inheritdoc}
    */
   public function authenticate() {
-    $this->token = $this->client->getAccessToken('authorization_code',
-      ['code' => $_GET['code']]);
+    $this->setAccessToken($this->client->getAccessToken('authorization_code',
+      ['code' => $_GET['code']]));
   }
 
   /**
-   * Gets the data by using the access token returned.
-   *
-   * @return League\OAuth2\Client\Provider\InstagramUser
-   *   User info returned by the Instagram.
+   * {@inheritdoc}
    */
   public function getUserInfo() {
-    $this->user = $this->client->getResourceOwner($this->token);
+    if (!$this->user) {
+      $this->user = $this->client->getResourceOwner($this->getAccessToken());
+    }
+
     return $this->user;
   }
 
   /**
-   * Gets the data by using the access token returned.
-   *
-   * @return string
-   *   Data returned by Making API Call.
+   * {@inheritdoc}
    */
-  public function getExtraDetails($url, $user_id) {
-    if($url) {
-      $baseUrl = 'https://api.instagram.com/v1';
-      $params  = 'access_token=' . $this->token;
-
-      //Replacing user_id with numerical user_id
-      $url = str_replace('user_id',$user_id,$url);
+  public function getAuthorizationUrl() {
+    $scopes = ['basic'];
 
-      $response = file_get_contents($baseUrl . $url . '/?' . $params);
-      return json_decode($response, TRUE);
+    $instagram_scopes = $this->getScopes();
+    if ($instagram_scopes) {
+      $scopes += explode(',', $this->getScopes());
     }
-  }
 
-  /**
-   * Returns token generated after authorization.
-   *
-   * @return string
-   *   Used for making API calls.
-   */
-  public function getAccessToken() {
-    return $this->token;
+    $options = [
+      'scope' => $scopes,
+    ];
+
+    return $this->client->getAuthorizationUrl($options);
   }
 
   /**
-   * Returns the Instagram login URL where user will be redirected.
-   *
-   * @return string
-   *   Absolute Instagram login URL where user will be redirected
+   * {@inheritdoc}
    */
-  public function getInstagramLoginUrl() {
-    $scopes = ['basic'];
+  public function getExtraDetails() {
+    $endpoints = $this->getEndPoints();
 
-    $instagram_scopes = explode(PHP_EOL, $this->getScopes());
-    foreach ($instagram_scopes as $scope) {
-      array_push($scopes, $scope);
-    }
+    // Store the data mapped with endpoints define in settings.
+    $data = [];
 
-    if ($this->getScopes()) {
-      $options = [
-        'scope' => $scopes,
-      ];
-      $login_url = $this->client->getAuthorizationUrl($options);
-    }
-    else {
-      $login_url = $this->client->getAuthorizationUrl();
+    if ($endpoints) {
+      // Iterate through api calls define in settings and retrieve them.
+      foreach (explode(PHP_EOL, $endpoints) as $endpoint) {
+        // Endpoint is set as path/to/endpoint|name.
+        $parts = explode('|', $endpoint);
+        $call[$parts[1]] = $this->requestEndPoint($parts[0]);
+        array_push($data, $call);
+      }
+
+      return json_encode($data);
     }
 
-    // Generate and return the URL where we should redirect the user.
-    return $login_url;
+    return NULL;
   }
 
   /**
-   * Returns the Instagram login URL where user will be redirected.
-   *
-   * @return string
-   *   Absolute Instagram login URL where user will be redirected
+   * {@inheritdoc}
    */
-  public function getState() {
-    $state = $this->client->getState();
+  public function requestEndPoint($path) {
+    $url = $this->client->getHost() . '/v1' . trim($path);
 
-    // Generate and return the URL where we should redirect the user.
-    return $state;
-  }
+    $request = $this->client->getAuthenticatedRequest('GET', $url, $this->getAccessToken());
 
-  /**
-   * Gets the data Point defined the settings form page.
-   *
-   * @return string
-   *   Data points separtated by comma.
-   */
-  public function getScopes() {
-    if (!$this->scopes) {
-      $this->scopes = $this->config->get('scopes');
-    }
-    return $this->scopes;
+    $response = $this->client->getResponse($request);
+
+    return $response->getBody()->getContents();
   }
 
   /**
-   * Gets the API calls to collect data.
-   *
-   * @return string
-   *   API calls separtated by comma.
+   * {@inheritdoc}
    */
-  public function getAPICalls() {
-    return $this->config->get('api_calls');
+  public function getState() {
+    return $this->client->getState();
   }
 
 }
diff --git a/src/Plugin/Network/InstagramAuth.php b/src/Plugin/Network/InstagramAuth.php
index 7c316c2..f8f07fb 100644
--- a/src/Plugin/Network/InstagramAuth.php
+++ b/src/Plugin/Network/InstagramAuth.php
@@ -136,32 +136,23 @@ class InstagramAuth extends NetworkBase implements InstagramAuthInterface {
     }
     /* @var \Drupal\social_auth_instagram\Settings\InstagramAuthSettings $settings */
     $settings = $this->settings;
-    // Proxy configuration data for outward proxy.
-    $proxyUrl = $this->siteSettings->get("http_client_config")["proxy"]["http"];
     if ($this->validateConfig($settings)) {
       // All these settings are mandatory.
+      $league_settings = [
+        'clientId' => $settings->getClientId(),
+        'clientSecret' => $settings->getClientSecret(),
+        'redirectUri' => $this->requestContext->getCompleteBaseUrl() . '/user/login/instagram/callback',
+      ];
+
+      // Proxy configuration data for outward proxy.
+      $proxyUrl = $this->siteSettings->get('http_client_config')['proxy']['http'];
       if ($proxyUrl) {
-        $league_settings = [
-          'clientId' => $settings->getClientId(),
-          'clientSecret' => $settings->getClientSecret(),
-          'redirectUri' => $this->requestContext->getCompleteBaseUrl() . '/user/login/instagram/callback',
-          'accessType' => 'offline',
-          'verify' => FALSE,
-          'proxy' => $proxyUrl,
-        ];
-      }
-      else {
-        $league_settings = [
-          'clientId' => $settings->getClientId(),
-          'clientSecret' => $settings->getClientSecret(),
-          'redirectUri' => $this->requestContext->getCompleteBaseUrl() . '/user/login/instagram/callback',
-          'accessType' => 'offline',
-          'verify' => FALSE,
-        ];
+        $league_settings['proxy'] = $proxyUrl;
       }
 
       return new Instagram($league_settings);
     }
+
     return FALSE;
   }
 
