Access token expiration + Sync period of time

Hello,

I would like to know if the access token expires. If it does, I will have to login again and I will receive a new token? I am asking this because I don’t see any api call for refreshing the token, only the authentication url.

I have seen that you have not implemented a subscription system (a system that sends a notification to me when a user updates its sensor), so I will have to use a polling system. I have to decide the polling period of time and would be awesome to know if you are updating your cloud in real-time when a user sync the data of a sensor with the smartphone (Flower Power App).

Thanks,

Miquel

Hi Miquel,

When you request the server for authentication, the api give you an access_token which expire in (about) 2592000 seconds or minutes (it’s very long) and a refresh_token: http://developer.parrot.com/docs/flowerpower/#flower-power-cloud-api

You can use the same authentication url and this refresh_token to get a new token. Look an example (in js): https://gist.github.com/bsautron/b5f5a839a4ca22aaaf8e

1 Like

Hi Bruno,

Thanks for your reply and for the example, has been very useful. I suppose that the expiration time is in seconds since 2592000 seconds are 30 days.

What about the second question I made? Can you give me more information about how do you sync the user data?

Thanks a lot!

Miquel

I don’t know realy how the sync works.

But for my usage:

  • When you add/delete a plants/sensors on the app, the server get immediately changements.
  • If you are connected with a flower power, the app send his samples to cloud, and you can see graphics (a FP record a sample every 15 minutes).
  • In live mode, there are no sync to cloud.

I’m not sure but I hope it will be useful.

Bruno

Hi Bruno,

Thanks again for your reply. I have been working with the cloud and I think that the device is saving new information every 15 minutes and the sync is done when you open the app and manual sync with the cloud.

Thanks a lot!

Miquel