discovery-tecnologia / dsc-mercado-livre

Biblioteca de integração com o Mercado Livre
Apache License 2.0
72 stars 29 forks source link

Example of: refresh token #4

Closed joacorob closed 6 years ago

joacorob commented 6 years ago

Hi! Could you give me some example about the best way to refresh token? thanks!

dilowagner commented 6 years ago

Hi @joacorob ! This is updated automatically. The library stores the access_token and refresh_token in the AccessToken object, when the request is called, it checks if the access_token is expired. If the access_token has been expired, it will be is updated with refresh_token.

Do you have any problem with this?

joacorob commented 6 years ago

image

Yes, but probably is because im in a local enviroment, so when y turn off my server the storage are missing? is probably?

dilowagner commented 6 years ago

Yes, probably...

Are you using http://localhost?

When I was testing, I also had these problems. I had that to configure a https:// address valid for my server for test this.

When you create your App on Mercado Livre, you need to add a URL for callback. The field is called "Redirect URI" and a valid https:// address must be given. It is to this address that CODE will be sent that the lib will retrieve and send back to the Mercado Livre to get the ACCESS_TOKEN.

Honestly, I find this kind of annoying. At least as far as I know, we could not test localhost.

joacorob commented 6 years ago

Perfect, i didnt config https in local, so i will test other enviroment. Thanks!