Outcome: any OpenID Connect library signs a user in against your environment, using the issuer URL and a client id. About ten minutes. You do not install an Authdog SDK for this path.

The environment public key (`pk_...`) validates Authdog session cookies. It is not an OIDC client id. This page uses the client you create under Security.

## 1. Copy the environment id

In the [console](https://console.authdog.com), open the environment you want the library to use and copy its id.

The issuer for that environment is:

```text
https://id.authdog.com/oidc/{environmentId}
```

If you mapped a vanity domain, do not hardcode the paths below. Fetch discovery and use the URLs it returns.

## 2. Read discovery

```bash
curl -sS "https://id.authdog.com/oidc/$ENVIRONMENT_ID/.well-known/openid-configuration"
```

The document includes `issuer`, `authorization_endpoint`, `token_endpoint`, `userinfo_endpoint`, and `jwks_uri`. Point the library at the issuer and let it read this document. Hand-copy an endpoint only when the library has no discovery support.

`registration_endpoint` is listed even when [dynamic client registration](/docs/mcp-authentication#dynamic-client-registration) is off. A register call returns 403 until you turn that on. This quickstart uses a client you create in the console.

## 3. Create the client

Open **Security → Clients** and create an OIDC client.

For a browser or mobile app, set token endpoint auth to **none**, require **PKCE (S256)**, and add the library's redirect URI. A public client has no secret. Sending one makes the token request fail.

For a server that can store a secret, leave token endpoint auth as **client_secret_basic**. The console shows the secret once. Store it outside the repo. You can rotate it later. The next response replaces the old secret, and the old value stops working.

Add `openid` to the client's scopes, plus `profile` or `email` if the library asks for them.

## 4. Configure the library

Give it three values:

| Setting | Value |
| --- | --- |
| Issuer | `https://id.authdog.com/oidc/{environmentId}` |
| Client id | The id from step 3 |
| Redirect URI | The same URI you saved on the client |

Use the authorization code flow. Public clients must send a PKCE S256 challenge and must omit `client_secret`. Confidential clients send the secret with the code exchange, using the auth method you selected.

The library verifies the ID token with `jwks_uri`. Do not pin a key from the console. Keys rotate.

## 5. Verify

Run discovery again. `issuer` must match the URL you configured, including the environment id.

Start a sign-in. After you approve the hosted consent screen, the library should hold an ID token whose `aud` is your client id.

If it fails:

- **`invalid_client` on the token call** — the secret is missing, extra, or from a different client. Public clients send no secret. A rotated secret replaces the previous one.
- **Redirect mismatch** — the redirect URI in the authorize request is not saved on the client, including scheme, host, port, and path.
- **Discovery 404** — the environment id is wrong, or the vanity host is not the issuer. Use the `issuer` field from a successful discovery response.

## Next

| Read | To learn how to |
| --- | --- |
| [MCP authentication](/docs/mcp-authentication) | Turn on dynamic client registration for MCP clients |
| [Machine identity](/docs/machine-identity) | Call the API with a token instead of a browser sign-in |
| [Node.js CLI](/docs/quickstarts/nodejs-cli) | Sign a person in from a terminal with the device grant |
