• Documentation
    • About ​ValidMind
    • Get Started
    • Guides
    • Support
    • Releases

    • ValidMind Library
    • Python API
    • Public REST API

    • Training Courses
  • Log In
  1. Install and initialize ValidMind
  2. Authenticate with OIDC device flow
  • ValidMind Library
  • Supported records and frameworks

  • Quickstart
  • Quickstart for documentation
  • Quickstart for validation
  • Quickstart (OIDC device flow)
  • Install and initialize ValidMind
    • Install and initialize the library
    • Authenticate with OIDC device flow
    • Install and initialize the library for R
    • Use an HTTP proxy with the library
  • Store credentials in .env files

  • End-to-End Tutorials
  • Development
    • 1 — Set up ValidMind Library
    • 2 — Start the development process
    • 3 — Integrate custom tests
    • 4 — Finalize testing & documentation
  • Validation
    • 1 — Set up ValidMind Library for validation
    • 2 — Start the validation process
    • 3 — Developing a challenger
    • 4 — Finalize validation & reporting

  • How-To
  • Run tests & test suites
    • Explore tests
      • Explore tests
      • Explore test suites
    • Run tests
      • Run dataset-based tests
      • Run comparison tests
      • Configuring tests
        • Configure judge LLM and judge embeddings
        • Customize test result descriptions
        • Enable PII detection in tests
        • Dataset Column Filters when Running Tests
        • Run tests with multiple datasets
        • Understand and utilize RawData in ValidMind tests
      • Using tests in documentation
        • Document multiple results for the same test
        • Run individual documentation sections
        • Run documentation tests with custom configurations
    • Custom tests
      • Implement custom tests
      • Integrate external test providers
  • Use library features
    • Data and datasets
      • Introduction to ValidMind Dataset and Model Objects
      • Dataset inputs
        • Configure dataset features
        • Load dataset predictions
    • Metrics
      • Log metrics over time
      • Intro to Unit Metrics
    • Qualitative text
      • Generate qualitative text with the ValidMind library
    • Scoring
      • Intro to Assign Scores

  • Notebooks
  • Code samples
    • Agents
      • Document an agentic AI system
    • Capital markets
      • Quickstart for knockout option pricing model documentation
      • Quickstart for Heston option pricing model using QuantLib
    • Code explainer
      • Quickstart for model code documentation
    • Credit risk
      • Document an application scorecard model
      • Document an application scorecard model
      • Document a credit risk model
      • Document an application scorecard model
      • Document an Excel-based application scorecard model
    • NLP and LLM
      • Sentiment analysis of financial data using a large language model (LLM)
      • Summarization of financial data using a large language model (LLM)
      • Sentiment analysis of financial data using Hugging Face NLP models
      • Summarization of financial data using Hugging Face NLP models
      • Automate news summarization using LLMs
      • Prompt validation for large language models (LLMs)
      • RAG Model Benchmarking Demo
      • RAG Model Documentation Demo
    • Ongoing monitoring
      • Ongoing Monitoring for Application Scorecard
      • Quickstart for ongoing monitoring of models with ValidMind
    • Regression
      • Document a California Housing Price Prediction regression model
    • Time series
      • Document a time series forecasting model
      • Document a time series forecasting model
    • Validation
      • Validate an application scorecard model

  • Reference
  • ​ValidMind test sandbox
  • ValidMind Library Python API
  • ValidMind Public REST API

On this page

  • Prerequisites
  • When should I use OIDC?
  • Authenticate with OIDC
    • 1. Get your OIDC code snippet
    • 2. Initialize the ValidMind Library
    • 3. (Optional) Store OIDC settings in an .env file
  • What happens after you sign in?
  • Try it in a notebook
  • What's next
  • Edit this page
  • Report an issue
  1. Install and initialize ValidMind
  2. Authenticate with OIDC device flow

Authenticate with OIDC device flow

Published

July 31, 2026

Authenticate the ValidMind Library with your organization's identity provider using the OAuth 2.0 / OIDC device authorization flow (RFC 8628), instead of long-lived API keys.

When OIDC is enabled for your organization, vm.init() opens a browser sign-in flow (verification URL and user code), then uses a bearer access token for ValidMind API calls. Cached tokens are reused and refreshed when possible.

Prerequisites

1 Your ValidMind administrator configures library connectivity and the OIDC device-flow client for your organization.

2 Upgrade the ValidMind Library

3 Register records in the inventory

4 Working with templates

When should I use OIDC?

Use the device flow when your organization prefers interactive IdP sign-in over API keys — for example, notebook or local CLI work under SSO policies.

NoteAPI keys and OIDC are mutually exclusive

Pass either api_key and api_secret or issuer and client_id (via arguments or environment variables). Mixing both raises an authentication error.

NoneCurrent scope
  • Supported for the Python ValidMind Library via vm.init().
  • Device authorization flow only. Redirect-based OAuth and client-credentials (machine-to-machine) grants are not supported by the library.
  • Availability depends on your organization's library connectivity settings. If Getting Started only shows an API key snippet, use Install and initialize the ValidMind Library.
  • The Public REST API can also accept OIDC bearer tokens when enabled for your organization. See Public REST API authentication.

Authenticate with OIDC

1. Get your OIDC code snippet

When your organization allows device-flow connectivity, the ValidMind Platform can show an OIDC snippet on the record Getting Started page:

  1. In the left sidebar, click Inventory.

  2. Select a record by clicking on it or find your record by applying a filter or searching for it.5

  3. In the left sidebar that appears for your record, click Getting Started.

  4. Select the Document you want to automatically upload test results to.6

  5. Under the OIDC connectivity section, click Copy snippet to clipboard.

5 Working with the inventory

6 Managing documents

If you see a message asking you to contact an administrator to set OIDC connectivity, your organization allows OIDC but the device-flow client settings are not configured yet. Ask your ValidMind administrator to complete that setup.

2. Initialize the ValidMind Library

Paste the snippet into your notebook or script. A typical OIDC vm.init() looks like this:

import validmind as vm

vm.init(
    api_host="https://API_HOST.validmind.ai/api/v1/tracking",
    issuer="https://login.microsoftonline.com/<tenant-id>/v2.0",
    client_id="<oauth-public-client-id>",
    audience="<api-audience-or-resource>",  # often required
    document="document-key",  # requires library >=2.12.0
    model="MODEL_IDENTIFIER",
)
Argument Environment variable Description
issuer VM_OIDC_ISSUER OpenID Provider issuer URL used for discovery
client_id VM_OIDC_CLIENT_ID Public OAuth client ID registered for device flow
audience VM_OIDC_AUDIENCE API audience / resource identifier (often required so tokens are accepted by ValidMind)
scope VM_OIDC_SCOPE Optional. Defaults to openid profile email offline_access
api_host VM_API_HOST Location of the ​ValidMind tracking API
model VM_API_MODEL Record identifier
document — Document to receive uploaded test results

When you run the cell, the library may print a verification URL and user code. Open the URL, enter the code, and complete sign-in with your identity provider. The notebook or script waits until authorization finishes.

To also enable monitoring, add monitoring=True to vm.init().7

7 Enable monitoring

3. (Optional) Store OIDC settings in an .env file

You can keep OIDC settings out of source code the same way you store API credentials:8

8 Store record credentials in .env files

VM_API_HOST=https://api.prod.validmind.ai/api/v1/tracking
VM_OIDC_ISSUER=https://login.microsoftonline.com/<tenant-id>/v2.0
VM_OIDC_CLIENT_ID=<oauth-public-client-id>
VM_OIDC_AUDIENCE=<api-audience-or-resource>
VM_API_MODEL=<model>

Then call vm.init() with only the values that should stay in the notebook, such as document= or monitoring=True.

What happens after you sign in?

  1. The library discovers your IdP from {issuer}/.well-known/openid-configuration.
  2. It starts the device authorization flow and waits for you to complete browser sign-in.
  3. Access (and refresh, when issued) tokens are cached under ~/.validmind/credentials.json.
  4. Later vm.init() calls reuse or refresh cached tokens when possible.
  5. API requests use Authorization: Bearer <access_token> instead of API key headers.

Treat the credentials file like other secrets on shared machines.

Try it in a notebook

For a full documentation walkthrough that uses OIDC instead of API keys, see Quickstart for model documentation (OIDC device flow).

What's next

Store record credentials in .env files
Learn how to store record (model) identifier credentials in an .env file instead of using inline credentials, allowing you to follow best practices for security when running Jupyter Notebooks.
Quickstart for model documentation (OIDC device flow)
Learn the basics of using ValidMind to document models as part of a model development workflow. This variant authenticates with the OIDC device authorization flow (RFC 8628) instead of storing API keys in the notebook: you sign in through your…
No matching items
Install and initialize the library
Install and initialize the library for R
  • ValidMind Logo
    ©
    Copyright 2026 ValidMind Inc.
    All Rights Reserved.
    Cookie preferences
    Legal
  • Get started
    • Development
    • Validation
    • Setup & admin
  • Guides
    • Access
    • Configuration
    • Integrations
    • Workflows
    • Inventory
    • Risk tiering
    • Documents & templates
    • Documentation
    • Validation
    • Reporting & auditing
    • Monitoring
    • Attestation
  • ValidMind Library
    • Quickstarts
    • Development tutorial
    • Validation tutorial
    • Run tests & test suites
    • Use library features
    • Code samples
    • Python API
    • Public REST API
  • Training
    • Learning paths
    • Courses
    • Videos
  • Support
    • Troubleshooting
    • FAQ
    • Get help
  • Edit this page
  • Report an issue
  • Community
    • GitHub
    • LinkedIn
    • Events
    • Blog