Issue repeatedly requesting new tokens?

I’m working on an app that connects to the Spark Core. To avoid any issues with expired tokens - is it ok to repeatedly ask for a new token? It would be whenever the user opens the app to control the Core - so once ever time the app opens a request for a new token is sent to that users core for the new token.

I was uncertain if the Core would rebel against repeated token requests. Such as -does the Core have a token limit that would be reached then block any new token requests? Or is requesting new tokens is a fine programmatic way to ensure the token is not expired.

Thanks for any info.

You can do that but end up with a ton of access token for you account.

I don’t think there’s a limit to the number of access token generation but that’s sounds like bad coding practice and handling method IMO :slight_smile:

Thanks for the info. The app will delete the newly created token on exit so there shouldn’t be too many tokens created. :smile:

Why do the expired token remain? I don’t believe you can renew expired tokens so why are expired token not auto removed?

Expired tokens are gone after 90 days.

I missed the part where you delete the access token each time you exit the app. That should work but it’s just something new to me.

Maybe others can comment on this approach :smiley:

Maybe you should probe for an existing token using the username/password credentials and only create one if you really need to?

http://docs.spark.io/api/#authentication-list-all-your-tokens