My website randomly started receiving this error. The module worked fine for quite some time, so much so that we didn't even notice it stop working.
exception 'InstagramException' with message 'BAD REQUEST' in /var/www/vhosts/stage/sites/all/modules/drupagram/drupagram.lib.php:409 Stack trace: #0 /var/www/vhosts/stage/sites/all/modules/drupagram/drupagram.lib.php(365): Instagram->request('https://api.ins...', Array, 'GET', true) #1 /var/www/vhosts/stage/sites/all/modules/drupagram/drupagram.lib.php(342): Instagram->auth_request('https://api.ins...', Array, 'GET') #2 /var/www/vhosts/stage/sites/all/modules/drupagram/drupagram.lib.php(181): Instagram->call('v1/users/!user_...', Array, 'GET', true) #3 /var/www/vhosts/stage/sites/all/modules/drupagram/drupagram.lib.php(297): Instagram->fetch('user_recent', Array, true) #4 /var/www/vhosts/stage/sites/all/modules/drupagram/drupagram.inc(174): Instagram->user_recent('436630767') #5 /var/www/vhosts/stage/sites/all/modules/drupagram/drupagram.module(168): drupagram_fetch_recent_items('436630767') #6 [internal function]: drupagram_cron() #7 /var/www/vhosts/stage/includes/module.inc(866): call_user_func_array('drupagram_cron', Array) #8 /var/www/vhosts/stage/includes/common.inc(5321): module_invoke('drupagram', 'cron') #9 /var/www/vhosts/stage/modules/system/system.admin.inc(2356): drupal_cron_run() #10 [internal function]: system_run_cron() #11 /var/www/vhosts/stage/includes/menu.inc(517): call_user_func_array('system_run_cron', Array) #12 /var/www/vhosts/stage/index.php(21): menu_execute_active_handler() #13 {main}
I've updated the API keys and everything seems right. Any ideas?
Comment | File | Size | Author |
---|---|---|---|
#12 | drupagram-set-correct-headers-on-get_access_token-2484333-12.patch | 1.65 KB | Daniel Korte |
#4 | drupagram_7_x_1_2.patch | 2.54 KB | vhin0210 |
Comments
Comment #1
skribbz14 CreditAttribution: skribbz14 commentedI was able to fix this, but uninstalling, installing the dev version, re-entering the api keys, and connecting the account to the user one more time.
Comment #2
DamienMcKennaSounds like this may be fixed in the current -dev release?
Comment #3
eg2234 CreditAttribution: eg2234 commentedI'm getting this error too, and updating to 7.x-1.2+14-dev isn't solving the issue.
Comment #4
vhin0210 CreditAttribution: vhin0210 commented@eg2234,
I also have this issue and I believe that it's because of instagram new api.
I created a patch for 7.x-1.2
Comment #5
jack.minster CreditAttribution: jack.minster as a volunteer commentedI applied the patch in #2484333-4: exception 'InstagramException' with message 'BAD REQUEST', but was still getting a BAD REQUEST exception. Looking at the response it indicated I had a bad access token (OAuthAccessTokenException , "The access_token provided is invalid."). Removing the instagram account through the Drupagram user page and re-adding/auth'ing with instagram appears to have worked.
Comment #6
vhin0210 CreditAttribution: vhin0210 commented@jack.minster
have you tried authenticating your user again? like delete the current connected user and connect again?
Comment #7
Finabluma CreditAttribution: Finabluma commentedSame problem here. I have applied the patch and also remove the account and still happens...
Comment #8
vhin0210 CreditAttribution: vhin0210 commentedMay i know which api are you trying to access?
Comment #9
mgpcreative CreditAttribution: mgpcreative commentedIs it possible that the issue is related to the fact that we need to be using OAuth 2.0 protocol according to https://www.instagram.com/developer/authentication/ instead of 1.0 that is currently used in the module?
Comment #10
Daniel KorteComment #11
Daniel KorteWhoops, didn't pick up the Related Issue I was trying to add... Here we go...
Comment #12
Daniel KorteI created a different patch that addresses the original issue. It appears to be that the correct headers are not sent. See here:
https://groups.google.com/forum/#!topic/instagram-api-developers/Dvu_4SX...
I was able to get things working with this patch which sets the correct request headers for the
get_access_token()
function.Comment #13
Daniel KorteComment #14
b_willems CreditAttribution: b_willems commentedFYI I applied the patch in https://www.drupal.org/node/2484333#comment-11281155, deleted the old account under /user/.../edit/drupagram, cleared cache, added the account back in and ran cron and it worked. No errors and images are back. Thx mucho for the patch!
Comment #15
mihaic CreditAttribution: mihaic as a volunteer commentedrecently had Invalid Instagram OAuth request: Token invalid
#12 worked for me very well
thanks for patch
Comment #17
Daniel KorteI applied this patch to latest dev branch.
Comment #19
jftzsmns CreditAttribution: jftzsmns commentedFound this thread through: https://www.drupal.org/node/2762823
I applied this patch to the latest stable release and can confirm it fixes the issue.