# @cubicecho/better-auth-oidc-pairing > Pair a better-auth app with an OIDC provider from a setup URL: Dynamic Client Registration (RFC 7591/7592) on top of @better-auth/sso. Agent-facing docs for @cubicecho/better-auth-oidc-pairing: one task or concept per page, then what each package.json "exports" entry exports. Generated from _agents/docs/ and the doc comments in src/ by @cubicecho/agent-docs; edit those, not this file. Requires Node >=22. Peer dependencies: `@better-auth/sso` >=1.7.28 <1.8.0, `better-auth` >=1.7.28 <1.8.0. ## Docs - [Install and wire it up](_agents/docs/01-install.md): What to install, the plugins to add, the column that has to be nullable, the two browser routes to forward, and the check to run at boot. - [Common mistakes](_agents/docs/common-mistakes.md): Mistakes that compile and start without an error and then go wrong, each with what happens and the fix. - [Endpoints and GraphQL](_agents/docs/endpoints.md): The plugin's endpoints on `auth.api` and over HTTP, who may call each, and how to serve them as GraphQL fields with @cubicecho/graphql-better-auth. - [The environment's provider and starting up](_agents/docs/environment-provider.md): How to pass a provider the operator set in the environment, what `pinned` does when it is a provider, `null` or left out, and what runs at the first request. - [Errors](_agents/docs/errors.md): The codes the endpoints refuse with and what to do about each, the codes a failed sign-in lands on the login page with, and the errors the protocol functions throw. - [Moving over from genericOAuth](_agents/docs/migrating-from-genericoauth.md): How an app that kept a pairing in its own table and signed in with better-auth's genericOAuth plugin moves the pairing and the environment's provider to this plugin. - [Options for pairing](_agents/docs/options.md): Who may pair, the extra client metadata to register, the hooks around a pairing, the settings and their defaults, and how ids and account names are picked. - [The protocol on its own](_agents/docs/protocol.md): How to parse a setup URL, register and delete a client, and move one to another redirect URI, as plain functions for an app that does not use the plugin. - [The sign-in](_agents/docs/sign-in.md): What the login page renders, how a sign-in reaches the app, how to spend the one-time token, and the cookie alternative. ## Exports: @cubicecho/better-auth-oidc-pairing - `DISCOVERY_PATH`: Where an issuer serves its OpenID Connect discovery document, under its own URL. - `PAIRING_DEFAULTS`: The shipped values of `PairingSettings`. - `PairingSettings` (type): Pairing with OIDC providers. - `PairingError`: A pairing that did not happen, and why. - `PairingFailure`: Why pairing failed, so the app can say what to do next. - `OidcPairingErrorCode`: The codes this plugin's refusals carry, besides a `PairingFailure` for a pairing the provider turned down. - `OidcPairingOptions` (type): How the plugin is set up. - `oidcPairing`: The pairing plugin: list, pair and unpair OIDC providers, kept as `@better-auth/sso` providers, with the environment's provider written at the first request, a start route for the browser and the one-time-token hand-off. - `oidcPairingPlugins`: The plugins a pairing app installs: `@better-auth/sso` set up so a pairing is the only way a provider gets in, then `oidcPairing`. - `PairedEvent` (type): What `afterPair` is told. - `PairingCaller` (type): Who is asking, for the app's `canPair` rule. - `ProviderSummary` (type): A provider as the endpoints answer it. - `UnpairedEvent` (type): What `afterUnpair` is told. - `providerIdFor`: Picks the id a newly paired provider is kept under: a slug of its name, numbered when taken. - `PairedProviderRow` (type): A paired provider as an `ssoProvider` row: what `pairedProviderRow` builds. - `PinnedProvider` (type): The environment's provider, as the app read it from its own environment. - `ProviderSource`: Where a provider came from. - `pairedProviderRow`: Builds the `ssoProvider` row for a paired provider, with every endpoint filled in so a sign-in never has to discover them. - `ClientAuthMethod`: How a confidential client sends its secret to the token endpoint. - `ClientRegistration` (type): The part of a pairing `deleteClient` needs. - `ClientRequest` (type): What the app asks to be registered as. - `DeleteOutcome`: How deleting a client at the provider went. - `deleteClient`: Deletes a registered client at the provider (RFC 7592). - `discover`: Reads an issuer's discovery document and checks that it is the issuer's own. - `ProviderMetadata` (type): What an issuer's discovery document says, once it has been checked as the issuer's own. - `RegisteredClient` (type): The client the provider registered, and what deletes it again. - `registerClient`: Registers the app with the provider a setup URL names (RFC 7591). - `updateClientRedirect`: Moves a registered client to a new redirect URI (RFC 7592): reads its metadata, then writes it back with `redirect_uris` replaced. - `parseSetupUrl`: Takes a setup URL apart. - `SetupUrl` (type): A setup URL, taken apart.