ForumsDevelopersIs there a way to get a non-expiring token?


Is there a way to get a non-expiring token?
Author Message
bresslerz

Posted: May 15, 2016
Score: 0 Reference
I have built a custom PHP web page to display on a kiosk in my house to show my daily tasks. It will only be used by me using my account. Is there a way that I can pass my client ID, secret, and some sort of token in a single call to get tasks for my account?

I've been experimenting with Oauth and I've gotten it to work, but having to store the access token for a set period of time and track that time before having to use the refresh token seems like a pain to code using the session or worse having to create a database.

In using twitter in the past from an Arduino, I could pass my client secret and a token (created through twitter's authorized interface) and it will always work. No need for storing tokens that expire...

Any thoughts?
Jake

Toodledo Founder
Posted: May 16, 2016
Score: 0 Reference
Sorry, but there isn't a way to get a non-expiring token right now. This is a security measure which you can read more about here: http://stackoverflow.com/questions/7030694/oauth2-why-do-access-tokens-expire

I think Twitter does things a little differently because they use a different authentication mechanism.
bresslerz

Posted: May 17, 2016
Score: 0 Reference
So does my app have to persist the auth token and refresh token and go through all of that mess even though I am the only user that will ever use it?

Darn! :(
Jake

Toodledo Founder
Posted: May 17, 2016
Score: 0 Reference
At the very least, your app will need to store the refresh token in some persistent manner. If it is just for you, then I would just grab the refresh token once and hard code it into a PHP variable in your app. Thats all you need to get a working access token whenever your app runs.

A slightly better way to do this would be to use PHP to write the refresh token to a file on your computer and then read it when you need it. This is only a few lines of code.

http://php.net/manual/en/function.file-put-contents.php
http://php.net/manual/en/function.file.php

But you should definitely consider adding a persistence layer to your program because downloading all of your tasks every time the app runs can be pretty heavy.
You cannot reply yet

U Back to topic home

R Post a reply

To participate in these forums, you must be signed in.