I followed the instructions: registered the application, added the client ID, client secret, and proper callback URL. When I go to add the instagram account at mysite.com/user i click "yes" and am redirected back with this error:

"Invalid Instagram OAuth request: Token invalid"

any ideas?

Comments

jpsimon’s picture

Just to see, I tried registering another application, and put in the new keys. Same error =\

rmontero’s picture

I can't seem to reproduce that error. Could you post some screenshots perhaps?

jpsimon’s picture

StatusFileSize
new31.78 KB

Signed in as admin i do the following:

go to: mysite.com/user
click: edit
click : instagram accounts
click: add account
- this brings me to the instagram site where i click 'yes' to authorize the app
click: yes
- brings me back to my site with the following error (attached screenshot)

drupal 7.4, using drupagram 7.x-1.1 (stable version)

jpsimon’s picture

Aside from enabling oauth, is there any setting up one needs to do with it to get this working? On the user page there is an "authorization" menu for oauth where you add a consumer/application... it wasn't mentioned in the install instructions for drupgram so i left all of that alone.

Itmman’s picture

same problem

davidknicker’s picture

same here, anyone find a fix for this?

15dk51’s picture

Same problem. It gave a fetal error.

mstrelan’s picture

Same problem here. Could it be that it's running on a local URL?

rmontero’s picture

Sorry for the late response mstrelan dkiscool davidzk Itmman jpsimon

Did you see any reports on the Status Report ( /admin/reports/status )

This can happen when your PHP does not have the CURL library installed.

Check your php.ini settings to make sure you are loading the CURL library.

mstrelan’s picture

exception 'InstagramException' with message 'Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?' in E:\www\drupal-7.14\sites\all\modules\drupagram\drupagram.lib.php:408 Stack trace: #0 E:\www\drupal-7.14\sites\all\modules\drupagram\drupagram.lib.php(560): Instagram->request('https://api.ins...', Array, 'POST', false) #1 E:\www\drupal-7.14\sites\all\modules\drupagram\drupagram.lib.php(544): InstagramOAuth->auth_request('https://api.ins...', Array, 'POST', false) #2 E:\www\drupal-7.14\sites\all\modules\drupagram\drupagram.pages.inc(379): InstagramOAuth->get_access_token('1c89deb5a7a1426...', 'http://drupal-7...') #3 E:\www\drupal-7.14\includes\form.inc(1460): drupagram_oauth_callback_form_validate(Array, Array) #4 E:\www\drupal-7.14\includes\form.inc(1400): form_execute_handlers('validate', Array, Array) #5 E:\www\drupal-7.14\includes\form.inc(1133): _form_validate(Array, Array, 'drupagram_oauth...') #6 E:\www\drupal-7.14\includes\form.inc(848): drupal_validate_form('drupagram_oauth...', Array, Array) #7 E:\www\drupal-7.14\includes\form.inc(706): drupal_process_form('drupagram_oauth...', Array, Array) #8 E:\www\drupal-7.14\sites\all\modules\drupagram\drupagram.pages.inc(334): drupal_form_submit('drupagram_oauth...', Array) #9 [internal function]: drupagram_oauth_callback(Array, Array) #10 E:\www\drupal-7.14\includes\form.inc(800): call_user_func_array('drupagram_oauth...', Array) #11 E:\www\drupal-7.14\includes\form.inc(341): drupal_retrieve_form('drupagram_oauth...', Array) #12 E:\www\drupal-7.14\includes\form.inc(131): drupal_build_form('drupagram_oauth...', Array) #13 [internal function]: drupal_get_form('drupagram_oauth...') #14 E:\www\drupal-7.14\includes\menu.inc(516): call_user_func_array('drupal_get_form', Array) #15 E:\www\drupal-7.14\index.php(21): menu_execute_active_handler() #16 {main}

rmontero’s picture

Component: Miscellaneous » Documentation
Status: Active » Closed (cannot reproduce)

mstrelan this seems to be a Windows only error that has to do with your local environment's configuration not being able to support SSL.

Unfortunately Instagram uses https as the communication protocol for all of their endpoints.

Here is what I found while googling your problem:

Make sure your php_openssl.dll permissions are correct.
Add C:\PHP\ext to the Windows path
Add the libeay32.dll and ssleay32.dll to C:\WINDOWS\system32\inetsrv
Reboot the server

I found these things to try on this page: http://php.net/manual/en/install.windows.extensions.php

Hope this helps resolve your issue.

jaspher’s picture

Status: Closed (cannot reproduce) » Needs review

Enabling the php_openssl extension will fix this.

jaspher’s picture

Status: Needs review » Closed (works as designed)

Sorry did not mean to re-open. Closing as works as designed.

junwei.maven’s picture

I'm getting similiar error log in mac localhost.

exception 'InstagramException' with message 'BAD REQUEST' in /Applications/MAMP/htdocs/me/sites/all/modules/others/drupagram/drupagram.lib.php:409 Stack trace: #0 /Applications/MAMP/htdocs/me/sites/all/modules/others/drupagram/drupagram.lib.php(561): Instagram->request('https://api.ins...', Array, 'POST', false) #1 /Applications/MAMP/htdocs/me/sites/all/modules/others/drupagram/drupagram.lib.php(545): InstagramOAuth-........

php_openssl and curl are enable as shown in phpinfo.

Any advise?

Siegricho’s picture

Status: Closed (works as designed) » Needs work

I'm asking people to get here from a duplicate post, I see there are some solutions posted but none has helped me so far Curl is enabled and I'm still getting the same error. Thanks

karopka’s picture

Issue summary: View changes

same here

chered’s picture

does anyone has any fix for this. my curl is also activated but getting this same error.

amogiz’s picture

same problem here

amogiz’s picture

Any help would be very appreciate.
I spent hours and hours trying to make it work.
Thanx

bensey’s picture

Having the same issue, everything seems in order.
Tried all the patches and solutions discussed in this and several other active issues, but no cigar.

mihaic’s picture

Please see this issue here:
https://www.drupal.org/node/2484333

Patch #12 applied against latest dev version solved the problem.
You might need to remove the Instagram account and re-add.

nchase’s picture

The Patch #12 @ https://www.drupal.org/node/2484333 against latest dev didn't help. Still getting the invalid oauth token. On the same site the Twitter module using oauth is working.

sthomen’s picture

The patch in #12 did not help for me, but I traced the problem (that I had) down and this patch against the dev version made everything work for me. It might work with the stable release as well.

--- drupagram.lib.php.orig 2015-02-13 16:46:18.000000000 +0200
+++ drupagram.lib.php    2016-10-25 10:50:40.487239700 +0300
@@ -398,8 +398,9 @@
       }
     }

-    $headers = array();
-    // @TODO: implement headers when $use_auth == TRUE
+    $headers = array(
+       'Content-Type' => 'application/x-www-form-urlencoded'
+    );

     $response = drupal_http_request($url, array(
       'headers' => $headers,
daniel korte’s picture

@sthomen Are you sure you implemented the patch in #12 correctly? Because your above code snippet is essentially what #12 does, but in a way that allows the function to be more versatile than hardcoding in the headers.

sthomen’s picture

You're right, they're functionally the same. My apologies, Daniel. I must have gotten confused wich code I was actually running.

daniel korte’s picture

No worries! I just wanted to make sure nothing was wrong with that patch. Thanks.

daniel korte’s picture

Status: Needs work » Closed (duplicate)