# Accept apps identified by a URL

> Let apps you never registered, such as MCP clients and AI tools, sign your users in by publishing a document about themselves.

Your users reach for many third-party tools, MCP clients and AI assistants among them, that you can't register one by
one. An app like this uses an `https` address as its client id and publishes a document there describing itself;
once you accept such apps, your users can sign in to it straight away. You keep control: these apps get only the
scopes and APIs you set aside for them, consent is never skipped for them, and you can block any one by its address.

**Before you start:**

- **Who can do it:** a realm administrator (a group holding `RealmOwner`).
- **Where:** today this is set through the API; [Call the API](../../../../develop/api/) shows how to get a session.
- **What you need:** the scopes and APIs such apps may reach, and the feature turned on for your realm: ask support
  to turn on apps identified by a URL (`clientIdMetadataDocuments`). A realm administrator can't turn it on.

## Accept them, within a fence

<Steps>

1. Once support has turned the feature on, set what such apps may get:

   ```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 '{
       "cimdScopes": ["openid", "profile", "notes:read"],
       "cimdResources": ["https://notes-api.example.com/"]
     }'
   ```

   `cimdScopes` is the most any such app may get. `cimdResources` lists the APIs they may call: none by default, so
   add the ones you mean them to reach. When it lists exactly one, a token request that names no API is for that one.

2. Tell app makers what to publish. At its client id address, for example
   `https://notes.example.com/oauth-client.json`:

   ```json
   {
     "client_id": "https://notes.example.com/oauth-client.json",
     "client_name": "Notes",
     "redirect_uris": ["https://notes.example.com/callback"],
     "token_endpoint_auth_method": "none"
   }
   ```

   An app that proves itself with a key gives `"token_endpoint_auth_method": "private_key_jwt"` and a `jwks_uri` (or
   `jwks`) instead.

</Steps>

## Check it worked

Sign in to the app as a user. They see the usual sign-in, then a consent page naming the app by its published name,
with its address. The app then appears on their **Authorized Apps** page, where they can revoke it.

<Aside type="caution" title="Browser-only apps">
  Such an app isn't answered cross-origin yet, so an app that runs only in the browser can't read its token
  answers. See [Known limitations](../../../../reference/known-limitations/).
</Aside>

If the sign-in fails instead, the usual causes are: the app's address isn't `https`, its document's `client_id`
doesn't equal that address, its `redirect_uris` don't hold the one the app sent, or the address is in `cimdBlocked`.
See [Client metadata documents](../../../applications/registration/client-metadata-documents/) for every check. Each
token the app gets is a `TOKEN_ISSUED` record on the user's trail, naming the app's address as its client.

## Block one app, or all

To block one app, add its exact client id address to `cimdBlocked`. The list you send replaces the stored one, so
read the settings first with `GET https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Settings/oauth2Settings`, then send the list back with
the address added:

```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 '{ "cimdBlocked": ["…existing blocked addresses",
                    "https://notes.example.com/oauth-client.json"] }'
```

A blocked address is refused before any fetch, even while its document is cached. To stop accepting such apps at
all, ask support to turn the feature off.

## Related

- [Client metadata documents](../../../applications/registration/client-metadata-documents/): what the realm fetches
  and checks.
- [Consent](../../../../customer-identity/consent/): the page every such app goes through.
- [Let developers register their own apps](../developers-register-apps/): when an app should be registered.
