> ## Documentation Index
> Fetch the complete documentation index at: https://docs.modelence.com/llms.txt
> Use this file to discover all available pages before exploring further.

# loginWithMagicLink

[API Reference](/api-reference/modelence/client/functions/../../../index) / [modelence](/api-reference/modelence/client/functions/../../index) / [client](/api-reference/modelence/client/functions/../index) / loginWithMagicLink

> **loginWithMagicLink**(): `Promise`\<`null` | `User`>

Defined in: [packages/modelence/src/auth/client/index.ts:207](https://github.com/modelence/modelence/blob/0db3afaa9e9d0dc8b5bc30d984757f5ba9684f92/packages/modelence/src/auth/client/index.ts#L207)

Complete a magic link sign-in.

Call this from the page the magic link landing route redirects to. The
token is exchanged server-side via an httpOnly cookie, so no arguments are
needed. Signs the user in — creating the account first when the email is
not registered yet and the server enables `auth.magicLink.allowSignup` —
and returns the logged-in user.

## Example

```ts theme={null}
const user = await loginWithMagicLink();
```

## Returns

`Promise`\<`null` | `User`>
