# auth.required

Nobody is signed in, and this needs a signed-in user

Profile: [Errors](https://www.prongs.dev/docs/intents/errors.md) · Raised with: [`fail()`](https://www.prongs.dev/docs/profiles/errors.md) · Status: `401` · Message: yours

## Example

```ts
return fail('auth.required');
```

The caller gets

```bash
HTTP 401

{
  "ok": false,
  "error": "Sign in required.",
  "code": "auth.required"
}
```

## Choosing between neighbours

Find the row that describes your case, and use the intent on the right.

| If it is for… | Use |
|---|---|
| Nobody is signed in, and this needs a signed-in user | `auth.required` (this page) |
| A signed-in caller who may not do this | [`permission.denied`](https://www.prongs.dev/docs/intents/permission/denied.md) |

## Connections

Declared in the registry, both directions. Where an intent is used in your own code is something check and the gallery see; this site has no app code.

- Built from: [`status.unauthorized`](https://www.prongs.dev/docs/intents/errors.md#status-unauthorized)

## For registry authors

**Starter intents.** These are the intents `prongs add errors` puts in your registry, raised with [`fail()`](https://www.prongs.dev/docs/profiles/errors.md). Change the messages to suit your app, and the statuses through the [`status.*`](https://www.prongs.dev/docs/intents/errors.md#status) intents they are built from.

The entry `prongs add errors` writes into your registry. Change the message here, or the status through its [`status.*`](https://www.prongs.dev/docs/intents/errors.md#status) ref.

```ts
'auth.required': {
  kind: 'semantic',
  description: 'Nobody is signed in, and this needs a signed-in user',
  refs: ['status.unauthorized'],
  keywords: ['signed out', 'login', 'unauthenticated'],
  notFor: [
    {
      context: 'a signed-in caller who may not do this',
      instead: 'permission.denied',
    },
  ],
  binding: { publicMessage: 'Sign in required.' },
},
```
