Create endpoint OIDC provider
const url = 'https://api.defined.net/v1/endpoint-oidc-providers';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"Corporate SSO","clientID":"0oa1b2c3d4e5f6g7h8i9","clientSecret":"s3cr3t","issuerURL":"https://example.okta.com","enabled":true,"networkID":"network-KAOWMXZHZWCVMGGFKM22XEGYLE","roleID":"role-PZEDBXHCEXKAKJPZ6XOQTIAJA4","authValidityHours":720,"domainID":"domain-3QZRDHZ5SZBQ5DBHUQE6GSMXGI","autoAssignCIDRs":["100.100.0.0/22"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.defined.net/v1/endpoint-oidc-providers \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "Corporate SSO", "clientID": "0oa1b2c3d4e5f6g7h8i9", "clientSecret": "s3cr3t", "issuerURL": "https://example.okta.com", "enabled": true, "networkID": "network-KAOWMXZHZWCVMGGFKM22XEGYLE", "roleID": "role-PZEDBXHCEXKAKJPZ6XOQTIAJA4", "authValidityHours": 720, "domainID": "domain-3QZRDHZ5SZBQ5DBHUQE6GSMXGI", "autoAssignCIDRs": [ "100.100.0.0/22" ] }'Create an OIDC provider that lets users enroll hosts by signing in with their identity provider.
Token scope required: endpoint-oidc-providers:create
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
OAuth client ID issued by the identity provider.
OAuth client secret issued by the identity provider. Required when creating a provider. Omit when updating to keep the current secret.
HTTPS issuer URL of the identity provider. Its OpenID Connect discovery document at
/.well-known/openid-configuration must be reachable when the request is made, and its
issuer field must match this value exactly.
Whether users can enroll hosts by signing in with this provider. Requires domainID.
Network that hosts enrolled through this provider join.
Role assigned to hosts enrolled through this provider.
How long, in hours, a host keeps network access after its user signs in. Omit for access that does not expire.
Email domain whose users may sign in with this provider. Required when enabled is true,
and the domain must be verified before the provider can be enabled. Each domain may be
enabled on only one provider.
Prefixes from which hosts enrolled through this provider are assigned addresses. Each must exactly match the network’s IPv4 CIDR or IPv6 prefix. On a network with an IPv6 prefix, that prefix is always included even if omitted here. On a network using certificate version 1, the list is replaced with the network’s IPv4 CIDR.
Example
{ "name": "Corporate SSO", "clientID": "0oa1b2c3d4e5f6g7h8i9", "clientSecret": "s3cr3t", "issuerURL": "https://example.okta.com", "enabled": true, "networkID": "network-KAOWMXZHZWCVMGGFKM22XEGYLE", "roleID": "role-PZEDBXHCEXKAKJPZ6XOQTIAJA4", "authValidityHours": 720, "domainID": "domain-3QZRDHZ5SZBQ5DBHUQE6GSMXGI", "autoAssignCIDRs": [ "100.100.0.0/22" ]}Responses
Section titled “Responses”Successful operation
object
object
Whether users can enroll hosts by signing in with this provider.
Network that hosts enrolled through this provider join.
Role assigned to hosts enrolled through this provider.
How long, in hours, a host keeps network access after its user signs in. null means access
does not expire.
Email domain whose users may sign in with this provider.
Prefixes from which hosts enrolled through this provider are assigned addresses. Includes the network’s IPv6 prefix whenever the network has one.
Example
{ "data": { "id": "endpointoidc-WDRO5WY4LTKA2AALKZQ2OHBSDE", "organizationID": "org-F63A24JGCLJV3ZEUTLCBISGETA", "name": "Corporate SSO", "clientID": "0oa1b2c3d4e5f6g7h8i9", "issuerURL": "https://example.okta.com", "enabled": true, "networkID": "network-KAOWMXZHZWCVMGGFKM22XEGYLE", "roleID": "role-PZEDBXHCEXKAKJPZ6XOQTIAJA4", "authValidityHours": 720, "domainID": "domain-3QZRDHZ5SZBQ5DBHUQE6GSMXGI", "autoAssignCIDRs": [ "100.100.0.0/22", "fdef:c0:c0:1::/80" ] }}Validation error
object
object
A static name for the error type
A short human readable description of the error
Describes the variable missing or malformed
The query parameter the error relates to, such as filter.targetType
Machine-readable details about the error. ERR_LIMIT_EXCEEDED errors carry limit and limitName.
object
The maximum number of resources allowed
The kind of resource the limit applies to
Examples
A provider already exists with the name.
{ "errors": [ { "code": "ERR_DUPLICATE_VALUE", "message": "value already exists", "path": "name" } ]}The issuer's discovery document at `/.well-known/openid-configuration` could not be fetched or parsed.
{ "errors": [ { "code": "ERR_OIDC_DISCOVERY_VALIDATION_FAILURE", "message": "must have an accessible and valid discovery document", "path": "issuerURL" } ]}`issuerURL` does not match the `issuer` field of the discovery document.
{ "errors": [ { "code": "ERR_OIDC_ISSUER_DISCOVERY_MISMATCH", "message": "must match issuer field of discovery document", "path": "issuerURL" } ]}`enabled` is `true` but no `domainID` was given.
{ "errors": [ { "code": "ERR_MISSING_VALUE", "message": "domainID must be set if enabled is true", "path": "domainID" } ]}The domain is already enabled on another provider.
{ "errors": [ { "code": "ERR_DOMAIN_ALREADY_ENABLED", "message": "domain is already enabled on another provider", "path": "domainID" } ]}enabled is true but the domain has not been verified. On update, the message reads "cannot mark an endpoint OIDC provider enabled without a verified domain".
{ "errors": [ { "code": "ERR_DOMAIN_NOT_VERIFIED", "message": "cannot create an enabled endpoint OIDC provider without a verified domain", "path": "domainID" } ]}The network, role or domain does not exist.
{ "errors": [ { "code": "ERR_INVALID_REFERENCE", "message": "referenced value is invalid (perhaps it does not exist?)", "path": "networkID" } ]}An `autoAssignCIDRs` entry is an address rather than a CIDR prefix.
{ "errors": [ { "code": "ERR_INVALID_VALUE", "message": "must be a CIDR prefix, not an address", "path": "autoAssignCIDRs[0]" } ]}Creating the provider would exceed the organization's limit. Not returned on update.
{ "errors": [ { "code": "ERR_LIMIT_EXCEEDED", "message": "no more than 10 endpoint-oidc-providers are allowed", "extra": { "limit": 10, "limitName": "endpoint-oidc-providers" } } ]}The API key is missing, invalid or expired.
object
object
A static name for the error type
A short human readable description of the error
Describes the variable missing or malformed
The query parameter the error relates to, such as filter.targetType
Machine-readable details about the error. ERR_LIMIT_EXCEEDED errors carry limit and limitName.
object
The maximum number of resources allowed
The kind of resource the limit applies to
Example
{ "errors": [ { "code": "ERR_UNAUTHORIZED", "message": "unauthorized" } ]}The API key lacks a required scope.
object
object
A static name for the error type
A short human readable description of the error
Describes the variable missing or malformed
The query parameter the error relates to, such as filter.targetType
Machine-readable details about the error. ERR_LIMIT_EXCEEDED errors carry limit and limitName.
object
The maximum number of resources allowed
The kind of resource the limit applies to
Examples
The API key lacks a required scope.
{ "errors": [ { "code": "ERR_FORBIDDEN", "message": "api key must support the following scopes: hosts:read" } ]}The organization has exceeded its API request rate limit. Retry the request after a short delay.
object
object
A static name for the error type
A short human readable description of the error
Describes the variable missing or malformed
The query parameter the error relates to, such as filter.targetType
Machine-readable details about the error. ERR_LIMIT_EXCEEDED errors carry limit and limitName.
object
The maximum number of resources allowed
The kind of resource the limit applies to
Example
{ "errors": [ { "code": "ERR_TOO_MANY_REQUESTS", "message": "too many requests" } ]}