Flutter – Sign in with Device
Cotter's Passwordless SDK authenticates your user based on their device. It allows a seamless, fast, and secure way for your user to login to your React Native App.
Sign in with Device
In this guide we'll allow users to Sign In with Device using Cotter's SDK.
Add Cotter's SDK to your pubspec.yaml
, then run flutter pub get
. You may need to restart your flutter for it to run pod install (stop flutter run and re run it).
For Android: Update minSdkVersion
to 18
following the installation instructions.
Import Cotter in your lib/main.dart
, then initialize it inside HomePageState
.
You can create a free account at Cotter to get your API_KEY_ID
.
Sign Up: Call cotter.signUpWithDevice
and input the user's email, phone, or username. This will create a new user in Cotter and trust the current device to allow logins. This function returns a User object.
Sign In: Call cotter.signInWithDevice
. If the user is logging-in from a device that they trust, they'll automatically be approved. This function returns an Event object.
Make sure you allow Trusted Devices Method in the dashboard.
🎉 That's It!
Simply call the signUp
and login
functions from your login page, and you can allow your users to Sign In with Device with just 1 tap.
What's Next?
1. Approve login requests from a non-trusted device
Authenticate from a Non-Trusted Device2. Getting the Logged-in User
Getting the Logged-in User3. Getting Access Token, ID Token, and Refresh Token
Getting OAuth TokensLast updated