mercadolibre / php-sdk

MercadoLibre's PHP SDK
185 stars 266 forks source link

getAccessTokenFromRefreshToken Issues to get the new token #11

Closed pablovelasquez closed 11 years ago

pablovelasquez commented 11 years ago

I couldn't get a new token from the refresh token using the function in the sdk nor the example code here.

so to make it work I had to:

1) Modify the function getAccessTokenFromRefreshToken on meli.php adding
$result = $result['json']; before the result so that it could return the correct information, otherwise it couldn't get to the values in the return

2) When getting the array back with the new token, I did not only have to set the new token, but also the user id so that the SDK would take and work with the new tokem

$accessToken = $meli->getAccessTokenFromRefreshToken($refresh_token);

$meli->setAccessToken($accessToken);
$meli->setUserId($meli_user_id);

I hope this helps someone else with the same issue I had.