This is a discussion topic more than an outright question.
I'm about to begin with a new project that requires automatic requests to the Podio API from a user (the app auth won't be enough). Since the API support automatic renewal of the access_token through the refresh_token this shouldn't be any problems. I will use the PHP Library which take care of all of this very nicely, but I will have API calls all over our script which spawns some possible difficulties:
There is no way to know if the access_token has been updated other then to check after each API call either:
- There was more then 28800 seconds since the last call
- The access_token I had before the call is different than the one after
Both options require me to build the check after each API (= lots of redundant code), or build a wrapper for each API call (= a wrapper for the wrapper?).
A better solution would be to have hooks in the PHP Library, Wordpress does this very nicely. This way I could build one function that does this check and register it to the "access_token updated" hook.
What do you think of such a solution? Please give me your thoughts on this. Or is it something I missing here?
Please sign in to leave a comment.