在颤振应用程序中保存 jwt 令牌的最佳方法是什么? [英] What's the best way to save jwt tokens in flutter apps?

查看:13
本文介绍了在颤振应用程序中保存 jwt 令牌的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不仅仅是在哪里(例如:SQLite...),还有如何(库,最佳特定实践)?

Not just where (eg: SQLite...) but also how (libs, best specific practices)?

推荐答案

您可能不想将敏感数据存储在共享首选项中.相反,您可能想研究这样的插件:https://pub.dartlang.org/packages/flutter_secure_storage

You probably don't want to store sensitive data in shared preferences. Instead you might want to look into a plugin like this: https://pub.dartlang.org/packages/flutter_secure_storage

import 'package:flutter_secure_storage/flutter_secure_storage.dart';

// Create storage
final storage = new FlutterSecureStorage();

// Write value 
await storage.write(key: 'jwt', value: token);

这篇关于在颤振应用程序中保存 jwt 令牌的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆