Federico Diaz Bobillo

Members
  • Content Count

    3
  • Joined

  • Last visited

Posts posted by Federico Diaz Bobillo


  1. if I make a get in api orders when payments shows the link is in the url payments instead of collections

      "payments": - [
        - {
          "id": "816596482",
          "transaction_amount": 60,
          "coupon_amount": 0,
          "currency_id": "ARS",
          "status": "approved",
          "date_created": "2014-07-31T16:55:12.000-04:00",
          "date_last_modified": "2014-07-31T20:43:50.000-04:00",
        },
      ],
    

    ID is a link to https://api.mercadolibre.com/payments/816596482 but the answer is 403

    
      "message": "The caller is not authorized to access this resource",
      "error": "forbidden",
      "status": 403,
      "cause": [
      ],
    }
    

    would correct the link

     

    https://api.mercadolibre.com/collections/816596482?access_token=$ACCESS_TOKEN

     

     

    Not very relevant but left the comment. 

     

    bye


  2. Login works well, but when you run refresh token returns error 400. These are the code and the error.

    	require 'MercadoLivre/meli.php';
    	$verif_user = mysql_query("SELECT * FROM authentication_users WHERE user_id = $user_id_callback");
    	$oAuth = mysql_fetch_object($verif_user);
    	$meli = new Meli($conf['APP_ID'], $conf['SECRET_KEY'], $oAuth->access_token, $oAuth->refresh_token);
    		if(mysql_num_rows($verif_user) > 0) {
    		// Verifica la data de expires del token y hace el refresh_token
    		if($oAuth->expires_in < time()) {
    			try {
    				// Make the refresh proccess
    				$refresh = $meli->refreshAccessToken();
    				echo "<h1>REFRESH ACCESS TOKEN</h1>";
    				var_dump($refresh);
    				// Now we create the sessions with the new parameters
    				if($refresh['body']->access_token) {
    					mysql_query("UPDATE authentication_users SET access_token = '{$refresh['body']->access_token}', refresh_token = '{$refresh['body']->refresh_token}', expires_in =  ".(time() + $refresh['body']->expires_in)." WHERE user_id = $cust_id");
    				} else {
    					// aca puedes hacer el oauth novamente
    					print "Error refresh";
    				}
    			} catch (Exception $e) {
    				echo "Exception: ",  $e->getMessage(), "\n";
    			}
    		} else {
    			print "<center>AUTENTICADO</center>";
    			$user = $meli->get('users/me?access_token='.$oAuth->access_token);
    		}
    	
    	}
    

    Error: array(2) { ["body"]=> object(stdClass)#3 (4) { ["message"]=> string(103) "Error validating grant. Your authorization code or refresh token may be expired or it was already used." ["error"]=> string(13) "invalid_grant" ["status"]=> int(400) ["cause"]=> array(0) { } } ["httpCode"]=> int(400) } Error refresh