OAuth 2.0 - When should an access token be renewed with refresh token?

℡╲_俬逩灬. 提交于 2019-12-11 00:18:42

问题


I'm currently using OAuth 2.0 to access the Google API. From my understanding, I should use the returned refresh token to renew the access token. Should this be refreshed before it expires or should it be when the user requests data from the api using an access token that has expired?

If it should be done before it expires, should I just be running a cron job to update out of date tokens?

I'm using node.js and mongodb, if that has any bearing on the recommended solution.

Thanks a lot!


回答1:


It should be seamless.

When the user requests data from the API using an access token that has expired, this should trigger your framework to fail, renew, then retry.

No need for any cron jobs or stuff like that in the apps i've created.



来源:https://stackoverflow.com/questions/11436351/oauth-2-0-when-should-an-access-token-be-renewed-with-refresh-token

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!