From 3bebb0c973768d2b03299937ed6f5cfa4be7e66d Mon Sep 17 00:00:00 2001 From: pmercadocl <59211960+pmercadocl@users.noreply.github.com> Date: Wed, 12 Feb 2020 21:17:00 -0300 Subject: [PATCH] Validation for optional value. As described in documentation https://developers.mercadolibre.com.ar/es_ar/autenticacion-y-autorizacion#Refresh-token , application must have selected option "offline_access" to return a value, so this commit check if variable exist and is not empty. Meli library fail if application in Mercado Libre backend does not have set "offline_access" option. --- Meli/meli.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Meli/meli.php b/Meli/meli.php index 7664c78..6019249 100644 --- a/Meli/meli.php +++ b/Meli/meli.php @@ -106,7 +106,7 @@ public function authorize($code, $redirect_uri) { if($request["httpCode"] == 200) { $this->access_token = $request["body"]->access_token; - if($request["body"]->refresh_token) + if(isset($request["body"]->refresh_token) && !empty($request["body"]->refresh_token)) $this->refresh_token = $request["body"]->refresh_token; return $request;