Skip to main content

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? (30 h 41 min)

You also get:

55 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()

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.