简体   繁体   English

在 Javascript 中使用访问令牌和刷新令牌

[英]Using access token and refresh token in Javascript

I've written a React-Redux app that uses the Reddit API to retrieve an access token for the user to view posts.我编写了一个 React-Redux 应用程序,该应用程序使用 Reddit API 检索访问令牌以供用户查看帖子。 I'm currently saving the access token in localStorage for convenience but I'm certain it's not safe to do so, while I also haven't been able to write working code to use the refresh token to update the access token every hour.为方便起见,我目前将访问令牌保存在localStorage中,但我确信这样做不安全,同时我也无法编写工作代码来使用刷新令牌每小时更新访问令牌。 Help with and insight on this would be greatly appreciated (details and code can be seen at https://github.com/DavyK17/fgc-reddit/issues/12 ).对此的帮助和见解将不胜感激(详细信息和代码可以在https://github.com/DavyK17/fgc-reddit/issues/12中查看)。

The example in this page is good explained and it is working great: React Refresh Token example此页面中的示例得到了很好的解释,并且效果很好: React Refresh Token example

Hope that answers your question希望这能回答你的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM