• 0
Sign in to follow this  
fabiogomez28

autentication return empty acces token

Question

hi . 
 
I had the problem with authentication when requesting the access token. the server returned me
 

Array
(
[access_token] =>
[expires_in] => 1402341901
[refresh_token] =>
)

 

I am using PHP SDK and the parameter APP_ID,SECRET_KEY ,REDIRECT_URI  were well ,i think  the problem was in the curl configuration,i decide  print the error in the function execute of mail.php using  curl_error

 

public function execute($path, $opts = array(), $params = array()) {
        $uri = $this->make_path($path, $params);
 
        $ch = curl_init($uri);
        curl_setopt_array($ch, self::$CURL_OPTS);
 
 
        if(!empty($opts))
            curl_setopt_array($ch, $opts);
   
$response = curl_exec($ch);
//print error
$error = curl_error($ch);
echo $error;
print_r($response);
        $return["body"] = json_decode($response);
        $return["httpCode"] = curl_getinfo($ch, CURLINFO_HTTP_CODE);
 
        curl_close($ch);
        
        return $return;
    }
 
this return me 
 
Unknown SSL protocol error in connection to api.mercadolibre.com:443 Array
 
searching on google I found the solution, there to add the option  curl_setopt($ch, CURLOPT_SSLVERSION, 3) and it worked. 
 
SOLVED.
 

 

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

for best practises you only add CURLOPT_SSLVERSION => 3 to array $CURL_OPTS like this

 

public static $CURL_OPTS = array(
        CURLOPT_USERAGENT => "MELI-PHP-SDK-1.0.0", 
        CURLOPT_SSL_VERIFYPEER => false,
        CURLOPT_CONNECTTIMEOUT => 10, 
        CURLOPT_RETURNTRANSFER => 1, 
        CURLOPT_TIMEOUT => 60,
        CURLOPT_SSLVERSION => 3
    );

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this