• 0
Sign in to follow this  
Katiko

No access token returned

Question

Hello, using the following code:

 

appId=7026179813746210;
MELI.init({client_id: appId});
  
    
    MELI.login(function() {
	MELI.get(
 		"/users/me",{},
	    function(data) { alert("Hello "+data[2].first_name) }
	);
});

I only get "Hello undefined".

I say no access token is returned beause I also tried the list example, however token value was null.

Is there something I'm missing?
Tried on:
Firefox, chrome, safari. Osx Mountain lion.

Regards.

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hello, I just tried the php sample (on github). Login doesn't return any token either, this time I tried with firefox + IE on windows 8 machine.

Would anybody mind explaining if I'm missing some steps?

a) code is from: https://github.com/mercadolibre/php-sdk/blob/master/examples/example_login.php

B) app_id + secret changed in this line

$meli = new Meli('APP_ID', 'SECRET_KEY', $_SESSION['access_token'], $_SESSION['refresh_token']);

tried with and without $_session (acess token and refresh).
c) redirected url to server.

The array only returns:

 

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


What a I missing?

 

 

Regards.

Share this post


Link to post
Share on other sites
  • 0

I don´t understand why have post with acccess_token

 

$meli = new Meli('APP_ID', 'SECRET_KEY', $_SESSION['access_token'], $_SESSION['refresh_token']);

 

in this moment you don´t have a valid access_token, so must be:

$token = $meli->refreshAccessToken();
 
in authorize you can to use a script with infos that have in your Meli Application and "GET Code", this url can generate the code:
 
with the code in your hands you can generate the access token using url:

 

--note that the MercadoLivre error in using the variable name client_id, should be app_id

 

EASY!!!!

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