# Show or skip the consent page

> Decide what users see when an app asks for access, name the app as they should see it, and let your own trusted apps skip the page.

Before an app gets anything in a user's name, the realm shows them a consent page: what the app asks for, with
**Allow** and **Deny**. The page is on by default and needs nothing from you. This guide is for the realm
administrator who wants the page to name each app well, and who wants the apps the organization owns, where asking
would only get in the way, to skip it.

**Before you start:** you hold `RealmOwner` in the realm, with your session in `$CVYUH_SESSION` (see
[Call the API](../../../develop/api/)), and you have the app's client ID, here `example-app`.

## What users see

A page in their own language that names the app by its `clientName` and lists what it asks for.

- **Allow** sends them back to the app, signed in.
- **Deny** sends them back to the app, which is told `access_denied`.
- The page can be answered once, only by the user signing in, within ten minutes by default
  (`consentChallengeLifetimeSecs`). A link to it copied to another browser is refused.

## Name the app

Set the name users should see on the app's client. An app with no `clientName` is shown by its client ID.

```sh
curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Client/example-app \
  -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
  -H "Content-Type: application/json" \
  -d '{ "clientName": "Example App" }'
```

## Let a trusted app skip the page

<Steps>

1. Allow skipping in the realm:

   ```sh
   curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Settings/oauth2Settings \
     -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
     -H "Content-Type: application/json" \
     -d '{ "consentSkipAllowed": true }'
   ```

2. Mark the app as one that skips:

   ```sh
   curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Client/example-app \
     -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
     -H "Content-Type: application/json" \
     -d '{ "consentImplied": true }'
   ```

</Steps>

The page is skipped only when all three hold: the realm allows it (`consentSkipAllowed`), the client asks for it
(`consentImplied`), and the app is confidential, or a public app whose return address is `https`. A public app
returning to a loopback port or a custom scheme is always asked, because another program on the same device could
claim that address.

<Aside type="caution" title="Some requests are always asked">
  Even for a trusted app, the user is asked when the request includes `offline_access` (access while they're away),
  sends `prompt=consent`, or carries `authorization_details`.
</Aside>

## Check it worked

Sign in to the trusted app as a user who has never used it. The browser returns to the app with a code, and no
consent page is shown. Sign in to any other app, and the page names it by its `clientName`.

## Undo it

Send `{ "consentImplied": false }` for the app, or `{ "consentSkipAllowed": false }` for the realm to make every app
ask again.

## Related

- [The consent page](../../consent/consent-page/): when the realm asks, and every setting.
- [Remember what users allowed](../remembered-consent/): how often a user is asked again.
- [Let users remove apps they allowed](../people-remove-apps/): the user's side of consent.
