OIDC

OpenID Connect (OIDC) Authentication for the Snipe-IT API

OpenID Connect (OIDC) Authentication for the Snipe-IT API

Snipe-IT supports optional OpenID Connect (OIDC) bearer-token authentication for its REST API. This allows applications and integrations to authenticate using tokens issued by an external identity provider instead of relying exclusively on Snipe-IT API tokens.

Supported identity providers include Microsoft Entra ID (formerly Azure AD), Okta, Keycloak, Auth0, Google, and other providers that support standard OpenID Connect discovery.

OIDC authentication is disabled by default and must be explicitly enabled through environment variables.

Existing Snipe-IT API tokens continue to work normally when OIDC authentication is enabled.

Why use OIDC authentication?

Traditionally, applications integrating with the Snipe-IT API authenticate using personal access tokens generated within Snipe-IT.

While these tokens work well for many integrations, they are typically long-lived credentials that must be securely stored, managed, and eventually rotated.

OIDC authentication provides an alternative for organizations that already use a centralized identity provider.

Benefits include:

  • Centralized authentication: Use your organization's existing identity provider to authenticate API requests.
  • Short-lived credentials: Applications can use tokens with limited lifetimes instead of storing long-lived Snipe-IT API tokens.
  • Improved credential management: Token issuance and expiration are managed by the identity provider.
  • Existing security policies: Depending on the identity provider and authentication flow, organizations can apply their existing authentication and access policies.
  • User accountability: API requests are associated with existing Snipe-IT users and are subject to their permissions.
  • Compatibility: Existing Snipe-IT API integrations continue working without modification.

OIDC authentication is particularly useful for organizations integrating Snipe-IT with internal applications, automation platforms, or other systems that already authenticate through a centralized identity provider.

How OIDC authentication works

When OIDC authentication is enabled, Snipe-IT accepts bearer tokens issued by configured, trusted identity providers.

The authentication process works as follows:

  1. An application obtains an appropriate access token from its identity provider.
  2. The application sends the token to the Snipe-IT API using the Authorization: Bearer HTTP header.
  3. Snipe-IT verifies the token's signature, issuer, audience, and expiration.
  4. Snipe-IT identifies the corresponding existing user account.
  5. If authentication succeeds, the request is processed using that user's existing Snipe-IT permissions.

Important: OIDC authentication does not grant additional permissions. Users authenticated through OIDC have exactly the same Snipe-IT permissions as they would when authenticated through other supported methods.

Snipe-IT does not automatically create new user accounts through OIDC API authentication. The corresponding user must already exist and be active.

Requirements

Before enabling OIDC authentication, you will need:

  • A working Snipe-IT installation that includes OIDC API authentication support.
  • Access to the Snipe-IT .env configuration file.
  • An OpenID Connect-compatible identity provider.
  • An API application or resource configured with your identity provider.
  • The issuer URL and audience identifier for your API.
  • Existing Snipe-IT user accounts corresponding to the identities that will authenticate.

Your identity provider must issue appropriately signed JWT access tokens.

Snipe-IT supports asymmetric signing algorithms, including RSA and elliptic-curve algorithms. Symmetrically signed tokens are not supported.

Configuration

OIDC API authentication is configured using environment variables in your Snipe-IT .env file.

Enable OIDC authentication

Add the following configuration to your .env file:

OIDC_API_ENABLED=true
OIDC_API_ISSUERS=https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0
OIDC_API_AUDIENCE=api://YOUR_API_CLIENT_ID

Replace the example values with those provided by your identity provider.

The feature will remain disabled unless OIDC_API_ENABLED is set to true and valid issuer and audience settings are provided.

Configuration options

Environment variableDescriptionDefault
OIDC_API_ENABLEDEnables or disables OIDC authentication for the API.false
OIDC_API_ISSUERSComma-separated list of trusted token issuers.Empty
OIDC_API_AUDIENCEComma-separated list of accepted token audiences.Empty
OIDC_API_JWKS_URIOptional URL for retrieving the provider's JSON Web Key Set.Automatic discovery
OIDC_API_ALGORITHMSComma-separated list of accepted JWT signing algorithms.RS256,RS384,RS512,ES256
OIDC_API_USERNAME_CLAIMToken claim used to match an existing Snipe-IT username when establishing an identity mapping.preferred_username
OIDC_API_LEEWAYAllowed clock skew, in seconds, when validating token expiration and validity times.60

Trusted issuers

The OIDC_API_ISSUERS setting identifies the identity providers that Snipe-IT will trust.

For example:

OIDC_API_ISSUERS=https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0

You can configure multiple issuers by separating them with commas:

OIDC_API_ISSUERS=https://idp1.example.com,https://idp2.example.com

Snipe-IT rejects tokens issued by providers that are not explicitly configured as trusted issuers.

Security consideration: Only configure identity providers that your organization trusts to authenticate users to Snipe-IT.

Token audience

The OIDC_API_AUDIENCE setting identifies the intended recipient of the access token.

For example:

OIDC_API_AUDIENCE=api://YOUR_API_CLIENT_ID

Some identity providers use an application client ID as the audience instead of an API URI.

You can specify multiple accepted audiences:

OIDC_API_AUDIENCE=api://YOUR_API_CLIENT_ID,YOUR_API_CLIENT_ID

The configured audience must match the aud claim in the JWT.

This prevents Snipe-IT from accepting tokens intended for unrelated applications.

Signing keys (JWKS)

Snipe-IT uses JSON Web Key Sets (JWKS) to verify the signatures of tokens issued by trusted identity providers.

By default, Snipe-IT discovers the signing-key endpoint using the provider's standard OpenID Connect discovery document.

For example:

https://idp.example.com/.well-known/openid-configuration

If your provider requires a specific JWKS endpoint, you can configure it manually:

OIDC_API_JWKS_URI=https://idp.example.com/.well-known/jwks.json

For most standards-compliant identity providers, this setting can be left unset.

Signing keys are cached to avoid contacting the identity provider for every API request.

Username claim

Snipe-IT needs to associate an authenticated identity with an existing Snipe-IT user.

The OIDC_API_USERNAME_CLAIM setting determines which JWT claim is used to match a Snipe-IT username when establishing that association.

The default is:

OIDC_API_USERNAME_CLAIM=preferred_username

For example, a token might contain:

{
  "iss": "https://idp.example.com",
  "sub": "00u123456789",
  "preferred_username": "jsmith",
  "aud": "snipe-it-api",
  "exp": 1790000000
}

If the Snipe-IT installation contains an active user with the username jsmith, that account can be used to establish the identity mapping.

If your identity provider uses a different claim, specify it explicitly:

OIDC_API_USERNAME_CLAIM=upn

Important: The configured claim must contain a value that matches the intended Snipe-IT username.

Snipe-IT does not automatically try alternative claims such as email addresses when the configured claim is missing.

Persistent identity mapping

Snipe-IT can associate users with an identity provider using the token's issuer (iss) and subject (sub) claims.

Once this association is established, subsequent authentication requests can identify the user through that issuer-and-subject combination.

This provides a more stable identity mapping than relying exclusively on usernames, which may change over time.

For configurations with multiple trusted issuers, administrators must ensure users are associated with the correct identity provider. Username-only matching is restricted to prevent identities from different providers from being confused with one another.

Example: Microsoft Entra ID

Microsoft Entra ID can issue access tokens for applications that need to communicate with the Snipe-IT API.

Step 1: Configure an API application

In Microsoft Entra ID:

  1. Open Microsoft Entra admin center.
  2. Navigate to App registrations.
  3. Create or select an application representing the API resource.
  4. Configure the application's API identifier and appropriate permissions.
  5. Record the tenant ID and API application identifier.

Your calling application must be authorized to request access tokens for this API resource.

Step 2: Configure Snipe-IT

Add the following settings to your .env file:

OIDC_API_ENABLED=true
OIDC_API_ISSUERS=https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0
OIDC_API_AUDIENCE=api://YOUR_API_CLIENT_ID
OIDC_API_USERNAME_CLAIM=preferred_username

Replace YOUR_TENANT_ID and YOUR_API_CLIENT_ID with your actual values.

Depending on your Entra application configuration, the audience may instead be the application's client ID.

Step 3: Verify the user exists

Ensure that the user authenticating through Entra ID already exists in Snipe-IT and is active.

For example, if Entra ID supplies:

{
  "preferred_username": "[email protected]"
}

The corresponding Snipe-IT username must match that value when establishing the identity mapping.

Step 4: Obtain an access token

Configure your calling application to request an access token for the API resource registered in Entra ID.

The exact process depends on the authentication flow used by your application.

Use an access token intended for your configured API resource, not an ID token or a token intended for Microsoft Graph.

Step 5: Make an API request

Once you have obtained an access token, include it in your request:

curl -X GET \
  "https://snipeit.example.com/api/v1/hardware" \
  -H "Authorization: Bearer YOUR_OIDC_ACCESS_TOKEN" \
  -H "Accept: application/json"

If the token is valid, the identity maps to an active Snipe-IT user, and that user has permission to view assets, the API returns the requested data.

Otherwise, the request will be rejected according to the applicable authentication or authorization rules.

Using OIDC with other identity providers

The configuration process is similar for other supported identity providers.

For each provider, you will need to determine:

  • The issuer URL.
  • The audience identifier for your API.
  • The claim containing the user's Snipe-IT username.
  • Whether the provider supports standard OIDC discovery.

For example, a Keycloak configuration might look like:

OIDC_API_ENABLED=true
OIDC_API_ISSUERS=https://keycloak.example.com/realms/company
OIDC_API_AUDIENCE=snipe-it-api
OIDC_API_USERNAME_CLAIM=preferred_username

The exact values depend on your identity provider's configuration.

Existing API tokens

Enabling OIDC authentication does not disable Snipe-IT's existing API token authentication.

Both authentication methods can be used simultaneously.

For example, an existing integration can continue using its Snipe-IT personal access token:

curl \
  "https://snipeit.example.com/api/v1/hardware" \
  -H "Authorization: Bearer YOUR_SNIPE_IT_API_TOKEN" \
  -H "Accept: application/json"

A different integration can authenticate using an OIDC access token:

curl \
  "https://snipeit.example.com/api/v1/hardware" \
  -H "Authorization: Bearer YOUR_OIDC_ACCESS_TOKEN" \
  -H "Accept: application/json"

Both requests use the same API endpoints.

There is no separate OIDC API URL, and no changes are required to existing integrations.

Security considerations

Token validation

Before accepting an OIDC token, Snipe-IT validates its signature and relevant claims.

These checks include:

  • The token was issued by a configured, trusted issuer.
  • The token's audience matches an accepted audience.
  • The token has not expired.
  • The token is valid according to its applicable time constraints.
  • The signature can be verified using the trusted provider's signing keys.
  • The token uses an accepted asymmetric signing algorithm.

Unsigned tokens and tokens using unsupported symmetric signing algorithms are rejected.

User permissions

OIDC authentication only establishes the identity of the API caller.

It does not bypass Snipe-IT's existing permission system.

For example, a user without permission to delete assets cannot gain that permission simply by authenticating through OIDC.

Existing users only

OIDC API authentication does not automatically provision users.

A valid token cannot create a new Snipe-IT account.

Users must already exist and be active to authenticate successfully.

Token lifetime and revocation

OIDC access tokens typically have shorter lifetimes than traditional personal access tokens.

However, token revocation behavior depends on the identity provider and the token's expiration time.

Because Snipe-IT validates JWTs locally, disabling a user at the identity provider does not necessarily invalidate an already-issued access token immediately.

Administrators should configure appropriate token lifetimes and disable the corresponding Snipe-IT account when immediate access removal is required.

Protecting access tokens

OIDC access tokens are bearer credentials.

Anyone who obtains a valid token may be able to use it until it expires.

Always use HTTPS, avoid exposing tokens in application logs, and follow your identity provider's recommended practices for secure token storage and handling.

Troubleshooting

API requests return HTTP 401 Unauthorized

A 401 Unauthorized response indicates that authentication was unsuccessful.

Possible causes include:

  • OIDC authentication is not enabled.
  • The configured issuer does not match the token's iss claim.
  • The configured audience does not match the token's aud claim.
  • The token has expired.
  • The token uses an unsupported signing algorithm.
  • Snipe-IT cannot retrieve the provider's signing keys.
  • The configured username claim is missing.
  • No matching active Snipe-IT user exists.
  • The user's identity provider mapping does not match the token.

For security reasons, Snipe-IT does not expose detailed token-validation errors to API callers.

Review the Snipe-IT application logs for additional diagnostic information.

The token is valid, but the user cannot authenticate

Verify that:

  1. The user exists in Snipe-IT.
  2. The Snipe-IT account is active.
  3. The configured username claim contains the expected value.
  4. The user's identity provider association is correct.
  5. The token was issued by a trusted provider.

Remember that successful authentication requires both a valid token and a matching Snipe-IT user.

Snipe-IT cannot retrieve signing keys

Verify that your Snipe-IT server can reach the identity provider's discovery and JWKS endpoints.

If necessary, configure the JWKS URL explicitly using OIDC_API_JWKS_URI.

Configuration changes are not taking effect

If your installation uses Laravel's configuration cache, clear and rebuild the configuration cache after modifying the .env file.

For example:

php artisan config:clear
php artisan config:cache

The exact commands may vary depending on your installation method.

Existing API integrations stop working

OIDC authentication is designed to work alongside existing Passport-based API authentication.

Existing API tokens should continue functioning without changes.

If an existing integration fails after enabling OIDC, verify that its original token is still valid and that the integration continues to send the expected authorization header.

You can also temporarily disable OIDC authentication to isolate the issue:

OIDC_API_ENABLED=false

Frequently asked questions

Does OIDC replace Snipe-IT API tokens?

No. OIDC authentication is optional and operates alongside existing API token authentication.

Do I need to enable OIDC to use Snipe-IT's API?

No. Existing API authentication methods continue to work.

Does this enable SSO for the Snipe-IT web interface?

No. This feature specifically enables OIDC bearer-token authentication for API requests.

It does not replace or configure interactive login to the Snipe-IT web interface.

Will Snipe-IT automatically create users from OIDC tokens?

No. Users must already exist in Snipe-IT.

Can I use multiple identity providers?

Yes. Multiple trusted issuers can be configured.

Additional care is required to associate users with the correct identity provider and prevent identity collisions.

Can I use OIDC with Microsoft Entra ID?

Yes. Microsoft Entra ID is supported, provided it is configured to issue suitable access tokens for your API application.

Does OIDC authentication change user permissions?

No. API requests continue to use the permissions assigned to the corresponding Snipe-IT user.

Can I disable OIDC authentication later?

Yes. Set:

OIDC_API_ENABLED=false

After applying the configuration change, OIDC tokens will no longer authenticate API requests.

Existing Snipe-IT API tokens will continue working.


Additional resources


Did this page help you?