samwilson / phpflickr

A PHP wrapper for the Flickr API, including OAuth.
https://packagist.org/packages/samwilson/phpflickr
GNU General Public License v2.0
39 stars 15 forks source link

Session auth broken #50

Closed clintonb closed 2 years ago

clintonb commented 2 years ago

I followed the example in examples/get_auth_token.php, and the web authentication failed after being redirected from Flickr with the query params. The page rendered as follows:


Warning: Undefined array key "oauth_token" in /Users/clintonb/workspace/clintonb/wp-flickr-base/vendor/carlos-mg89/oauth/src/OAuth/OAuth1/Service/Flickr.php on line 68

Warning: Undefined array key "oauth_token_secret" in /Users/clintonb/workspace/clintonb/wp-flickr-base/vendor/carlos-mg89/oauth/src/OAuth/OAuth1/Service/Flickr.php on line 69

Warning: Undefined array key "oauth_token" in /Users/clintonb/workspace/clintonb/wp-flickr-base/vendor/carlos-mg89/oauth/src/OAuth/OAuth1/Service/Flickr.php on line 70

Warning: Undefined array key "oauth_token_secret" in /Users/clintonb/workspace/clintonb/wp-flickr-base/vendor/carlos-mg89/oauth/src/OAuth/OAuth1/Service/Flickr.php on line 71
$accessToken = ""; $accessTokenSecret = "";
Fatal error: Uncaught Samwilson\PhpFlickr\FlickrException: Unable to decode Flickr response to flickr.test.login request: oauth_problem=token_rejected in /Users/clintonb/workspace/clintonb/wp-flickr-base/vendor/samwilson/phpflickr/src/PhpFlickr.php:358 Stack trace: #0 /Users/clintonb/workspace/clintonb/wp-flickr-base/vendor/samwilson/phpflickr/src/TestApi.php(33): Samwilson\PhpFlickr\PhpFlickr->request('flickr.test.log...', Array, true) #1 /Users/clintonb/workspace/clintonb/wp-flickr-base/examples/get_auth_token.php(63): Samwilson\PhpFlickr\TestApi->login() #2 {main} thrown in /Users/clintonb/workspace/clintonb/wp-flickr-base/vendor/samwilson/phpflickr/src/PhpFlickr.php on line 358
samwilson commented 2 years ago

This appears to be due to this change: https://github.com/carlos-mg89/PHPoAuthLib/commit/f08a062d5abe903a4092bcf92f855f6e2e7b676a

clintonb commented 2 years ago

That commit came from upstream of the fork: https://github.com/daviddesberg/PHPoAuthLib/issues/584. Still not sure why it’s there. Thanks for digging in!

samwilson commented 2 years ago

0.8.15 of the PHPoAuthLib is out, and upgrading makes examples/get_auth_token.php work again in the browser-based workflow. No changes required to PhpFlickr.

clintonb commented 2 years ago

Thanks!