# Effect (https://session-kit.pages.dev/docs/reference/effect)

```ts
import { … } from "@monarcode/session-kit/effect";
```

Guide: [Effect and effetch](https://session-kit.pages.dev/docs/effect).

## Classes

### Auth

Your auth client as an Effect service. Its Effects read the session, get an access token for API calls, sign in and out, update the user, and stream state changes.

### AuthFailure

How `Auth`'s Effects fail: a tagged error that carries the client's `AuthError`. Handle it with `Effect.catchTag("AuthFailure", …)` and match on `code`. The original error is the `cause`.

## Types

### AuthFailureCode

The codes an [`AuthFailure`](#authfailure) carries: every `AuthErrorCode` except `INVALID_OPTIONS`, which is misuse and so a defect.

### AuthLayerClient

What `Auth.layer` takes. Once you register a client in `Register`, that's your client, or on the server a request's session with the same user (`RequestAuth`). Until then, it's any [`AuthServiceClient`](#authserviceclient).

### AuthServiceClient

What `Auth` needs from a client. Any `createAuth` or `createMirrorAuth` client fits, and so does a fake with these members in tests. `signIn` is optional, because a mirror made without it has none.

### RegisteredSession

The session `Auth.session` gives you: your registered client's `Session`, never `null`.

### RegisteredSignIn

What `Auth.signIn` takes: your registered client's `signIn` input. It's `never` for a client without `signIn`.

### RegisteredState

Your registered client's `AuthState`, as `Auth.changes` emits it.

### RegisteredUserInput

What `Auth.updateUser` takes: your registered client's user input. It's `never` for a client without `updateUser`, such as one whose user comes from the access token.