Nueva pregunta

Pregunta:

Fecha: 14-02-2020 06:26:11 (En Español)

Obtener token de mercado libre a través de la API[No resuelta]

Buenas, estoy intentando obtener el token de Mercado libre con el ejemplo de example_login.php y me devuelve
Login using MercadoLibre oAuth 2.0 y no logro obtener el token. Obviamente cargo mis id, key y estoy probando con SSL https

Alguien me puede dar una mano? Desde ya muchas gracias. Saludos

<?php
session_start();

require '../Meli/meli.php';
require '../configApp.php';

$meli = new Meli($appId, $secretKey);

if(isset($_GET['code']) || isset($_SESSION['access_token'])) {

// If code exist and session is empty
if(isset($_GET['code']) && !isset($_SESSION['access_token'])) {
// //If the code was in get parameter we authorize
try{
$user = $meli->authorize($_GET["code"], $redirectURI);

// Now we create the sessions with the authenticated user
$_SESSION['access_token'] = $user['body']->access_token;
$_SESSION['expires_in'] = time() + $user['body']->expires_in;
$_SESSION['refresh_token'] = $user['body']->refresh_token;
}catch(Exception $e){
echo "Exception: ", $e->getMessage(), "\n";
}
} else {
// We can check if the access token in invalid checking the time
if($_SESSION['expires_in'] < time()) {
try {
// Make the refresh proccess
$refresh = $meli->refreshAccessToken();

// Now we create the sessions with the new parameters
$_SESSION['access_token'] = $refresh['body']->access_token;
$_SESSION['expires_in'] = time() + $refresh['body']->expires_in;
$_SESSION['refresh_token'] = $refresh['body']->refresh_token;
} catch (Exception $e) {
echo "Exception: ", $e->getMessage(), "\n";
}
}
}

echo '<pre>';
print_r($_SESSION);
echo '</pre>';

} else {
echo '<a href="' . $meli->getAuthUrl($redirectURI, Meli::$AUTH_URL[$siteId]) . '">Login using MercadoLibre oAuth 2.0</a>';
}


Etiquetas: PHP Votos: 0 - Respuestas: 2 - Vistas: 8 Compartir en: Google Facebook Twitter LinkedIn Link
 

Respuestas:

Para participar activamente de la comunidad primero debes autenticarte, ingresa al sistema.Iniciar Sesión
 
frjcbbae garagebible.com