daviddesberg / PHPoAuthLib

PHP 5.3+ oAuth 1/2 Client Library
Other
1.09k stars 453 forks source link

Amazon access token problem and fix #553

Open egekhter opened 5 years ago

egekhter commented 5 years ago
[2019-05-16 21:54:33] local.INFO: OAuth\Common\Http\Exception\TokenResponseException: Unable to parse response. in /home/memorable/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Amazon.php:74
Stack trace:
#0 /home/memorable/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/AbstractService.php(130): OAuth\OAuth2\Service\Amazon->parseAccessTokenResponse('\x1F\x8B\x08\x00\x00\x00\x00\x00\x00\x03L\xD4\xB7\xCE\xAC...')
#1 /home/memorable/app/controllers/user/UserLoginController.php(435): OAuth\OAuth2\Service\AbstractService->requestAccessToken('ANLdQgTbWizDNFl...')

The response from Amazon looked like this: ãL‘∑Œ¨fE—˛>∆__$2å;¬ÜúCÛâ4¿ês∞˝ÓŸç€]-ù?í,+ñ¨CSÙ?

I updated the getAccessTokenEndpoint method and everything worked as expected: From return new Uri('https://www.amazon.com/ap/oatoken');' to return new Uri('https://api.amazon.com/auth/o2/token');