---
title: ClerkAuth
description: Access sign-in methods and user state with ClerkAuth in your Flutter app.
---

`ClerkAuth` is the root control widget that initializes the Clerk auth system and makes auth state available to the
widget tree beneath it. All other Clerk widgets and helpers depend on a `ClerkAuth` ancestor being present.

---

## Access the ClerkAuthState

Call `ClerkAuth.of(context)` anywhere below a `ClerkAuth` widget to get the `ClerkAuthState` object. By default this
registers a rebuild dependency — the widget rebuilds whenever auth state changes. Pass `listen: false` to read the
state without subscribing to changes (useful outside of `build`).

```dart
final auth = ClerkAuth.of(context);
```

Sign-in methods are available directly on the `ClerkAuthState` object returned by `ClerkAuth.of(context)`.

```dart
final auth = ClerkAuth.of(context, listen: false);

// Email / password sign-in
await auth.attemptSignIn(
  strategy: Strategy.password,
  identifier: 'user@example.com',
  password: 'secret',
);

// OAuth sign-in (opens the provider's sign-in flow)
await auth.ssoSignIn(context, Strategy.oauthGoogle);

// Sign out the current user
await auth.signOut();

// Sign out of a specific session
final session = auth.session;
await auth.signOutOf(session!);
```

---

## Access user state

Use the static convenience methods or read directly from the auth state object.

```dart
// Static helpers (listen = true by default)
final user    = ClerkAuth.userOf(context);     // clerk.User?
final session = ClerkAuth.sessionOf(context);  // clerk.Session?

// Or via the auth state object
final auth    = ClerkAuth.of(context);
final user    = auth.user;         // clerk.User?
final session = auth.session;      // clerk.Session?
final isSigningIn = auth.isSigningIn; // bool — true while a sign-in is in progress
```
