hi Wesley. the maxium duration token for ArcGIS Online is 15 days. we are currently working on releasing a few proxy pages which will simplify the workflow of storing either a username/password or appId/appSecret to generate short-term tokens on the fly if you are interested in having an application authenticate on behalf of end users.