简体   繁体   中英

How do you store a token locally on a flutter web client

Say you get a token from server after logging in. I want the flutter web app to resume without the user logging in again, so I want to store something locally. There are packages that you can store the token locally to HTML localstorage, but it can be easily revealed using chrome developer tools. SecurePreference doesn't have a web version. Some packages stores in Indexed DB, but it suffers from the same problem. They can also be revealed by simple chrome developer tools.

Yes, you can store an encrypted version of the token to somewhere, but then where do you store the key? It will be stupid to store the key right next to the encrypted token.

You can use shared_preferences from pub.dev. Used for local storage in all the platform. https://pub.dev/packages/shared_preferences

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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