Viewing 15 replies - 1 through 15 (of 18 total)
  • Same problem!

    same problem

    idem

    Teguh

    (@teguhpratama)

    Strange ?? , I have no problem at all. Try to reset and connect again. And make sure OAuth redirect_uri is https://your-site.am/wp-admin/admin.php?page=yinstagram/settings.php

    I have reset and connect several time, the OAuth redirect_uri is good, I deactivated all other plugins and tried with all the default wordpress themes, but I still have the same problem, conflicting messages :
    “Connection to Instagram succeeded.” and “Not Connected.”

    You can see this capture

    still no solution to this problem .. and no response, yet the first post date there two months ??

    I hate forum posts that say “same here” because they never solve a problem, but… same here. I created an app, input the ID and Secret, and got the Not Connected error even though it said success. OAuth is correct.
    Plz halp!!

    By adding input we hope to possibly increase the urgency, if any, of solving the issue. Devs seem to be more inclined to work a multi user problem as opposed to single, and if you don’t have anything different going on other than what’s in the OPs post, same here is sufficient IMO. I hope it is solved soon, this plugin looked promising, just adding my 2¢ in case it helps you help another person.

    Teguh

    (@teguhpratama)

    hmmm… let’s try this, I’m just curious

    on /wp-content/plugins/yakadandada-instagram/admin/page-settings.php

    add this code (after line-3)

    <?php if (!function_exists('curl_version')): ?>
      <div class="error">
        <p>Please enable cURL.</p>
      </div>
    <?php endif; ?>
    

    So it will look like

    <div class="wrap">
      <div id="icon-edit" class="icon32 icon32-posts-quote"></div>
      <h2>Settings</h2>
      <?php if (!function_exists('curl_version')): ?>
        <div class="error">
          <p>Please enable cURL.</p>
        </div>
      <?php endif; ?>
      <?php if ($message): ?>
        <div class="<?php echo $message['class']; ?>">
      ...
    

    then open your settings page -> https://your-site.am/wp-admin/admin.php?page=yinstagram/settings.php

    if no red message go to next step below

    Teguh

    (@teguhpratama)

    Add this code to /wp-content/plugins/yakadandada-instagram/admin/functions.php (after line-377, or last line)

    function yi_get_access_token($code) {
      $data = yinstagram_get_options('settings');
    
      // Get cURL resource
      $curl = curl_init();
      // Set some options - we are passing in a useragent too here
      curl_setopt_array($curl, array(
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_URL => 'https://api.instagram.com/oauth/access_token',
        CURLOPT_USERAGENT => 'Access Token Request',
        CURLOPT_POST => 1,
        CURLOPT_POSTFIELDS => array(
          'client_id' => $data['client_id'],
          'client_secret' => $data['client_secret'],
          'grant_type' => 'authorization_code',
          'redirect_uri' => admin_url('admin.php?page=yinstagram/settings.php'),
          'code' => $code
        )
      ));
      // Send the request & save response to $resp
      $resp = curl_exec($curl);
      // Close request to clear up some resources
      curl_close($curl);
      return $resp;
    }
    

    still on /wp-content/plugins/yakadandada-instagram/admin/functions.php add this code (on line-149)

    $message = maybe_serialize(array('cookie' => 1, 'class' => 'error', 'msg' => 'Connection to Instagram failed.'));
    $response = json_decode( yi_get_access_token($_GET['code']) );
    if ( isset($response->access_token) ) {
      update_option('yinstagram_access_token', $response);
      $message = maybe_serialize(array('cookie' => 1, 'class' => 'updated', 'msg' => 'Connection to Instagram succeeded.'));
    }
    

    so it will look like

    ...
    } else {
      $message = maybe_serialize(array('cookie' => 1, 'class' => 'error', 'msg' => $response['errors']['http_request_failed'][0]));
    }
    
    $message = maybe_serialize(array('cookie' => 1, 'class' => 'error', 'msg' => 'Connection to Instagram failed.'));
    $response = json_decode( yi_get_access_token($_GET['code']) );
    if ( isset($response->access_token) ) {
      update_option('yinstagram_access_token', $response);
      $message = maybe_serialize(array('cookie' => 1, 'class' => 'updated', 'msg' => 'Connection to Instagram succeeded.'));
    }
    
    setcookie('yinstagram_response', $message, time()+1, '/');
    wp_redirect(admin_url('admin.php?page=yinstagram/settings.php')); exit;
    }
    /* end of authentication */
    ...
    
    Christian

    (@christiankramer)

    Hi,

    i saw you pasted the solution above into a new version. But it doesn’t work. The same message: “not connected”.

    Any other tipp?

    Regards,
    CK

    Christian

    (@christiankramer)

    Did anyone have found a solution?

    After a good 6 hours of being infuriated, I found my way into the rabbit hole, and found me a real error message! Problems with an SSL. Whose SSL do you ask? Mine. Well thats funny, my site doesnt have a SSL Cert.

    So, I went into the admin/functions.php file and changed the following all I did was add CURLOPT_SSL_VERIFYPEER => 0, to not validate the SSL.:

    // Set some options - we are passing in a useragent too here
      curl_setopt_array($curl, array(
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_URL => 'https://api.instagram.com/oauth/access_token',
        CURLOPT_USERAGENT => 'Yakadanda Instagram Access Token Request',
        CURLOPT_POST => 1,
        CURLOPT_POSTFIELDS => array(
          'client_id' => $data['client_id'],
          'client_secret' => $data['client_secret'],
          'grant_type' => 'authorization_code',
          'redirect_uri' => admin_url('admin.php?page=yinstagram/settings.php'),
          'code' => $code
        )

    to

    // Set some options - we are passing in a useragent too here
      curl_setopt_array($curl, array(
        CURLOPT_SSL_VERIFYPEER => 0,
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_URL => 'https://api.instagram.com/oauth/access_token',
        CURLOPT_USERAGENT => 'Yakadanda Instagram Access Token Request',
        CURLOPT_POST => 1,
        CURLOPT_POSTFIELDS => array(
          'client_id' => $data['client_id'],
          'client_secret' => $data['client_secret'],
          'grant_type' => 'authorization_code',
          'redirect_uri' => admin_url('admin.php?page=yinstagram/settings.php'),
          'code' => $code
        )

    I think i found a solution.
    The plugin worked for my personal instagram account but it didn’t work on a client account i was working on.
    So i checked his profile and realized that on his Biography there were some corrupted characters, i just deleted those characters and it worked!

    @morajau
    You rock! Totally the solution that worked for me.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Not Connected’ is closed to new replies.