amazon-pay-sdk-php icon indicating copy to clipboard operation
amazon-pay-sdk-php copied to clipboard

urldecode the access_token in GetORODetails call

Open danielneu opened this issue 9 years ago • 2 comments

Hi Shravan,

we just encountered a situation where the API told us, that the access_token is not a valid AddressConstenToken.

The cause was that we extracted the value with $_REQUEST['access_token'] and simply passed it on to the call. The format was ATza%7d... instead of Atza|..., so the call failed. A urldecode solved the problem.

Could you please add a check, so that the value can be passed in and the SDK takes care about the rest?

Best wishes Daniel

danielneu avatar Sep 30 '15 14:09 danielneu

hi Daniel the code in the lines below should have worked. i URL decode the access token and encode it again as that is the required manner in which the access token has to be sent. I will also double verify and check this by sending the accesstoken both ways (Atza% & Atza |) // To make sure double encoding doesn't occur decode first and encode again. $accessToken = urldecode($accessToken); $url = $this->profileEndpoint . '/auth/o2/tokeninfo?access_token=' . urlEncode($accessToken);

shrakuma avatar Sep 30 '15 16:09 shrakuma

Hi Shravan,

I was just thinking if we could do something like the following inside the SDK:

if(!strpos($access_token, "|"){ $access_token = urldecode($access_token); } ...

Or something more elaborate, but I think the idea is clear.

Best wishes Daniel

danielneu avatar Oct 01 '15 07:10 danielneu