Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

Storing Authentication Tokens on Device

Premium
3 min read

Now that we have our Navigation bar, we should consider our user experience. Currently, each time users launch the app, they have to log in. This is not a good user experience. We should store the token on the device so that users don't have to log in each time they launch the app.


Installing Package

First, we need a secure way to store the information. While we could use a simple filesystem, there is a package that makes it easier for us. We'll use the flutter_secure_storage package.

flutter pub add flutter_secure_storage

Once the package is installed, we can store the token...

The Full Lesson is Only for Premium Members

Want to access all of our courses? (29 h 14 min)

You also get:

54 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

YC
Yohn Cheung ✓ Link copied!

I was getting this error:

Exception has occurred.
MissingPluginException (MissingPluginException(No implementation found for method write on channel plugins.it_nomads.com/flutter_secure_storage)).

But i was able to solve this by adding this:

WidgetsFlutterBinding.ensureInitialized();

This needs to be added in the void main()