> For the complete documentation index, see [llms.txt](https://docs.cotter.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cotter.app/quickstart-guides/flutter-sign-in-with-device.md).

# Flutter – Sign in with Device

## Sign in with Device

In this guide we'll allow users to **Sign In with Device** using Cotter's SDK.&#x20;

Add [Cotter's SDK](https://pub.dev/packages/cotter#-installing-tab-) 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).

```yaml
dependencies:
  cotter:
```

**For Android**: Update `minSdkVersion` to `18` [following the installation instructions](/sdk-reference/flutter.md).

Import Cotter in your `lib/main.dart`, then initialize it inside `HomePageState`.

```dart
import 'package:cotter/cotter.dart'; // Import Cotter

class HomePageState extends State {
  ...

  // 1⃣ Initialize Cotter
  Cotter cotter = new Cotter(apiKeyID: API_KEY_ID); // 👈 Specify your API KEY ID here

  // 2️⃣ Sign Up Function
  void signUp() async {
    try {
      // 🚀 One-line Sign Up
      var user = await cotter.signUpWithDevice(identifier: inputController.text);
    } catch (e) {
      print(e)
    }
  }
  
  // 3️⃣ Login Function
  void login(BuildContext context) async {
    try {
      // 🚀 One-line Login
      var event = await cotter.signInWithDevice(identifier: inputController.text, context: context);
    } catch (e) {
      print(e)
    }
  }
  
  @override
  Widget build(BuildContext context) { ... }
} 
```

You can [create a free account at Cotter](https://dev.cotter.app) 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](/api-reference/user-api/user-object.md).

**Sign In:** Call `cotter.signInWithDevice` . If the user is logging-in [from a device that they trust](/features/passwordless-login.md), they'll automatically be approved. This function returns an [Event object](/api-reference/event-object.md).

{% hint style="info" %}
**Make sure you allow Trusted Devices Method in the** [**dashboard**](https://dev.cotter.app)**.**
{% endhint %}

## 🎉 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 ta&#x70;**.**

![Passwordless Login with Flutter using Cotter's SDK](/files/-M9agBdGGVrDaZwCHkiO)

## What's Next?

**1. Approve login requests from a non-trusted device**

{% content-ref url="/pages/-M9arREAyqZyslAP96BY" %}
[Authenticate from a Non-Trusted Device](/sdk-reference/flutter/sign-in-with-device/authenticate-from-a-non-trusted-device.md)
{% endcontent-ref %}

#### 2. Getting the Logged-in User

{% content-ref url="/pages/-M9awQf5uqyq2X9ZO4JM" %}
[Getting the Logged-in User](/sdk-reference/flutter/getting-the-logged-in-user.md)
{% endcontent-ref %}

#### 3. Getting Access Token, ID Token, and Refresh Token

{% content-ref url="/pages/-M9axG8HPu6f\_at6wCcT" %}
[Getting OAuth Tokens](/sdk-reference/flutter/getting-oauth-tokens.md)
{% endcontent-ref %}
