> From *AT Protocol Spaces: A Field Guide* on atproto.how, revised 2026-11-23.
> Web page: https://atproto.how/atproto-spaces-field-guide/9-oauth-and-consent
> Index for agents: https://atproto.how/llms.txt · Text CC BY-SA 4.0, code samples MIT.

# Chapter 9 · OAuth and consent

An app gets access to a person’s spaces through OAuth, which makes OAuth a practical requirement for any app that works with spaces. On the consent screen, the person is asked which spaces the app may reach (by authority, type, and key), what it may do to their records (`action` and `collection`), and whether it may manage the spaces themselves (`manage`). All of that is carried by the `space:` scope. The app has to scope it carefully. Asking for too little cuts the app off from what it needs, and asking for too much puts both the app and the person at risk.

> **If you’re building an app**
>
> Your app asks for space access in its OAuth scopes, and users see that request on the consent screen. Think critically about what your app needs, and be aware of accidental OAuth scope permission creep. The `authority` parameter defaults to the user’s own identity, so an app that reads spaces run by someone else asks for `authority=*` or names the authority. Read access always covers the whole space, while writes can be narrowed to particular collections.

Consider a session upgrade checkpoint for the parts of your app that need more. A person signs in with a general set of `space:` permissions for everyday use. When they open an admin or moderation area, the app asks them to authenticate again with the expanded permissions those tools need. The clean way to do this is to treat the upgraded session as a separate app with its own `client_id`, so the person and the app can both tell the two sessions apart and track each one.

<a id="grammar"></a>

## 9.1 Grammar

> *In the family space.* Ruth signs in to the family app for the first time. Her PDS shows a consent screen asking whether the app may use her Family updates spaces. She approves it. What did she agree to?

**Reference: The `space:` scope** \[spec\]

Ruth’s session holds `space:com.example.familyUpdates?authority=*`.

```text
space:<spaceType>
  [?authority=<did>|self|*]
  [&skey=<skey>|*]
  [&collection=<nsid>|*]...
  [&action=read_self|read|create|update|delete]...
  [&manage=create|update|delete]...
```

Shown wrapped; a real scope is one token \[spec\].

<a id="table-9-1"></a>

**Table 9.1.** Scope parameters and their defaults

| Parameter | Multiple | Default |
| --- | --- | --- |
| `spaceType` | no | required; an NSID or `*` |
| `authority` | no | `self`, the granting user’s own DID |
| `skey` | no | `*` |
| `collection` | yes | the type declaration’s `collections` |
| `action` | yes | `read`, `create`, `update`, `delete` |
| `manage` | yes | none |

The type may also be given as a named parameter, `space?spaceType=com.example.familyUpdates&authority=*`, but not both ways in one scope. `atproto-oauth` accepts both forms \[crates\].

The `authority=self` default is the important one. A bare `space:com.example.bookmarks` covers only the user’s own bookmarks space. The family app reads a space anchored on Marcus’s identity, so for everyone but Marcus it must say `authority=*` or name the authority \[spec\].

<a id="read-is-all-or-nothing"></a>

## 9.2 Read is all-or-nothing

The `read` action is what lets an app read *other* members' repos, because it grants `getDelegationToken` along with the read and sync methods on the user’s own PDS. It applies to every repo in the matching spaces and ignores `collection`. `read_self` is the narrower option, with the same read methods for the user’s own repo only and no delegation token. Granting `read` also grants `read_self` \[spec\].

There is no per-collection or per-author read grant. A credential reads the whole space, so a narrower OAuth grant couldn’t be enforced anyway.

<a id="writes-and-management"></a>

## 9.3 Writes and management

`create`, `update`, and `delete` act on specific records and are constrained by `collection`. With `collection` omitted, they cover the type’s declared collections, resolved when the grant is evaluated, not frozen at consent. When the lexicon author adds a collection, existing bare grants widen to include it once caches turn over. An app that wants a fixed set lists collections explicitly. With `spaceType=*`, a grant has no type declaration to fall back on, so its writes reach only the collections it lists \[spec\].

That widening is intentional. A space type that expects many collections can lean on the default, so its `space:` scopes stay short instead of naming every collection, and apps pick up new collections as the type grows without asking people to consent again. The trade-off is that the lexicon author, not the person who consented, decides how far a bare grant reaches.

The type’s collection list is a default, not a limit. A scope with no `collection` gets exactly the listed collections, so a bare grant on a type that lists `com.example.foo` lets an app write `com.example.foo` records and nothing else. A scope that names `com.example.bar` explicitly lets the app write those records too, even though the type doesn’t list them.

Applications can support space management features through the `manage` attribute of the `space:` scope, which covers the spaces themselves rather than the records in them \[spec\]. Each value authorizes a set of methods:

<a id="table-9-2"></a>

**Table 9.2.** Space management grants

| `manage` | Authorizes |
| --- | --- |
| `create` | `createSpace` for that type, usually with `skey=*` |
| `update` | `updateSpace`, `removeWriter` under every policy, and each policy’s administrative methods, such as memberspace `putMembers` and `removeMembers` |
| `delete` | `deleteSpace` |
| `create` and `update` | `importSpaceMeta` |

Migrating records is the one place the two kinds of grant meet: `importRepo` needs the record action `create` on every collection in the archive.

A `manage` grant covers the space type as a whole. No parameter narrows it to particular policies, so an app holding `manage=create` or `manage=update` can create or update a space under any policy \[spec\].

The power and scope of the `manage` field is intentional and by design. There are no finer-grained management permissions, and the risk is real. An app holding `manage=update` could let a person make a space public by accident, switch its policy type and lose its member list, or take other harmful and destructive actions. That’s the case for the step-up sessions described under If you’re building an app, so management grants aren’t used casually. It’s also a case for confirmation or two-factor steps in the app. A space owner’s PDS or space host should be able to lock or disable some kinds of management action, or at least notify the owner when one happens.

Write methods accept only OAuth, since writes are attributed to the user. Read and sync methods accept either a covering OAuth scope or a space credential \[spec\].

<a id="worked-scopes"></a>

## 9.4 Worked scopes

> *In the family space.* The family app asks Marcus for more than it asks everyone else. Marcus creates the space and manages its members. Elena, Ruth, Nora, and Jake read the space and write their own posts, RSVPs, and bookmarks. Elena also uploads photos.

**Reference: The family app’s session scopes**

| Session | Scopes | Grants |
| --- | --- | --- |
| Marcus | `space:com.example.familyUpdates?manage=create&manage=update` | Create and update his own family updates spaces and manage their members, plus full read and writes to the declared collections |
| Elena | `space:com.example.familyUpdates?authority=*` and `blob:image/*` | The same reads and writes in every family updates space she’s in, plus image uploads |
| Ruth, Nora, and Jake | `space:com.example.familyUpdates?authority=*` | Elena’s grant without uploads |

Each session also holds the base `atproto` scope. Marcus’s scope leaves out `authority`, so it covers only spaces he’s the authority of. Without `manage=delete`, this session can’t delete them.

A few other shapes cover cases the family app doesn’t need:

<a id="table-9-3"></a>

**Table 9.3.** Worked space scopes

| Scope | Grants |
| --- | --- |
| `space:com.example.bookmarks` | Own bookmarks: read and write declared collections |
| `space:com.example.familyUpdates?authority=*&action=read` | Same, read only |
| `space:com.example.familyUpdates?authority=*&action=read_self` | Own records only, as for a backup tool |
| `space:com.example.familyUpdates?authority=*&collection=*` | Full read, write any collection |
| `space:com.example.familyUpdates?authority=did:plc:ejjl2znzqp3ci25dqaslpkk2&skey=our-family&collection=community.lexicon.calendar.rsvp&action=create&action=update` | Create and update RSVPs in the family space |
| `space:com.example.familyUpdates?authority=*&action=read_self&manage=update&manage=delete` | Administer own family updates spaces, no record writes |
| `space:*?authority=did:plc:ejjl2znzqp3ci25dqaslpkk2` | Read every space under one authority |

<a id="permission-sets"></a>

## 9.5 Permission sets

Applications are encouraged to use permission sets whenever possible, because they make for a much better user experience. A permission set describes what the app is asking for in friendlier wording, which is often clearer and easier to read than the raw scopes. The family app publishes `com.example.authFamilyMember` for its members and requests it as `include:com.example.authFamilyMember`:

<a id="code-9-1"></a>

```json
{
  "type": "permission-set",
  "title": "Family updates",
  "detail": "Read your family's updates and post your own",
  "permissions": [
    {
      "type": "permission",
      "resource": "space",
      "spaceType": "com.example.familyUpdates",
      "authority": "*",
      "action": [
        "read",
        "create",
        "update",
        "delete"
      ]
    }
  ]
}
```

Inside a permission set, `spaceType` must name a concrete type that follows the set’s namespace-authority rules. `authority` and `collection` can still be wildcards, and `collection` can name NSIDs from other namespaces. A grant for every space type, written as `spaceType=*`, works only as a standalone scope \[spec\]. A `space:` scope names one space type, so an app that works with spaces in syzygy asks for one scope for each type, with the same `skey` in each, and a permission set can bundle them when the types fall under its namespace.

<a id="the-oauth-consent-screen"></a>

## 9.6 The OAuth consent screen

When Elena signs in to the family app, the OAuth consent screen leads with the permission set’s own words: "Family updates: Read your family’s updates and post your own" \[crates\]. Under that, each space permission names its type by the type declaration’s `title` ("Family updates"), localized with `title:lang`, and falls back to the NSID when there’s no title. A named authority appears as its handle when the handle verifies in both directions, and as its DID otherwise, and `self` needs no label \[spec\].

The screen saves its loudest warning for a scope with wildcards in both `authority` and `spaceType`, which reaches every space of every type \[spec\]. The family set names a concrete type, so even with `authority` set to `*`, Elena sees no warning.

<a id="common-questions"></a>

## 9.7 Common questions

**Why can’t my app ask to read just one collection?**

A credential reads the whole space, so a narrower read grant couldn’t be enforced. Writes are different, and `collection` narrows them.

**Why doesn’t my scope cover other people’s spaces?**

The `authority` parameter defaults to the user’s own identity. An app that reads spaces run by someone else asks for `authority=*` or names the authority.

**Do users approve again when a space type adds a collection?**

Existing sessions pick up the new collection on their own. A bare grant resolves the type’s collections each time it’s checked, so the change takes effect once caches refresh.
