OpenID Connect provider server for testing authentication
Actively maintained. Last release 8 weeks ago, commits in 26 of the last 26 weeks. A safe choice.
pip install oidc-provider-mockOpenID Provider Mock
A mock OpenID Provider server to test and develop OpenID Connect authentication.
You can find the full documentation here.
Usage
The simplest method to run the server is
pipx:
$ pipx run oidc-provider-mock
Started OpenID provider http://localhost:9400
Alternatively, you can run the server as a container:
docker run -p 9400:9400 ghcr.io/geigerzaehler/oidc-provider-mock
See the “Usage” documentation for details.
Now, configure your OpenID Connect client library in your app to use
http://localhost:9400 as the issuer URL. By default, you can use any client ID
and client secret with the provider.
Finally, you can authenticate against the app (the Relying Party) through the mock provider’s login form:

Take a look at the following example that uses the server in a test for a Flask-OIDC app.
@pytest.fixture
def oidc_server():
with oidc_provider_mock.run_server_in_thread() as server:
yield f"http://localhost:{server.server_port}"
def test_auth_code_login(client: flask.testing.FlaskClient, oidc_server: str):
# Add OIDC claims for the user we want to authenticate
response = httpx2.put(
f"{oidc_server}/users/{quote('alice@example.com')}",
json={"email": "alice@example.com", "name": "Alice", "custom": ["foo", "bar"]},
)
assert response.status_code == 204
# Start login on the client and get the authorization URL
response = client.get("/login")
assert response.location
# Authorize the client by POSTing to the authorization URL.
response = httpx2.post(response.location, data={"sub": "alice@example.com"})
# Go back to the client with the authorization code
assert response.has_redirect_location
response = client.get(response.headers["location"], follow_redirects=True)
# Check that we have been authenticated
assert response.text == "Welcome Alice (alice@example.com)"