---
title: "generate a turnkey OIDC / OAuth2 provider"
method: PUT
path: "/mockserver/oidc"
tags: ["oidc"]
---

# generate a turnkey OIDC / OAuth2 provider

`PUT /mockserver/oidc`

## Request

- Base URL: `http://localhost:1080`
- URL: `http://localhost:1080/mockserver/oidc`
- Auth: none declared

Generates a set of expectations that emulate an OpenID Connect / OAuth2 provider (discovery document, JWKS, token, authorize, userinfo and related endpoints) and adds them. An empty body uses the default provider configuration.

## Request body

- object: OIDC provider configuration; an empty body uses defaults
  - `issuer` string: issuer URL advertised in the discovery document and token claims
  - `clientId` string: OAuth2 client identifier
  - `clientSecret` string: OAuth2 client secret
  - `privateKeyPem` string: PEM-encoded signing private key (never serialized back in responses)
  - `scopes` string[]: supported OAuth2 / OIDC scopes
  - `tokenExpirySeconds` integer: lifetime of issued access tokens in seconds

## Response `201`

OIDC provider expectations created

- Expectation[]: list of upserted expectations (unresolved $ref)

## Other responses

- `400`: incorrect request format

---

[API](https://skmtc.dev/mock-server/apis/mockserver-api.md) · [All operations](https://skmtc.dev/mock-server/apis/mockserver-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mock-server/apis/mockserver-api/revisions/9239b693996e?raw)
