Skip to main content

keys

Creates, updates, deletes, gets or lists a keys resource.

Overview

Namekeys
TypeResource
Idokta.apps.keys

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
createdstring (date-time)Timestamp when the object was created (example: 2017-03-28T01:11:10.000Z)
estringRSA key value (public exponent) for Key binding
expiresAtstring (date-time)Timestamp when the certificate expires
kidstringUnique identifier for the certificate
ktystringCryptographic algorithm family for the certificate's keypair. Valid value: RSA
lastUpdatedstring (date-time)Timestamp when the object was last updated
nstringRSA modulus value that is used by both the public and private keys and provides a link between them
usestringAcceptable use of the certificate. Valid value: sig
x5carrayX.509 certificate chain that contains a chain of one or more certificates
x5t#S256stringX.509 certificate SHA-256 thumbprint, which is the base64url-encoded SHA-256 thumbprint (digest) of the DER encoding of an X.509 certificate

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_application_keysselectsubdomainLists all key credentials for an app
get_application_keyselectsubdomainRetrieves a specific Application Key Credential by kid
generate_application_keyinsertvalidityYears, subdomainGenerates a new X.509 certificate for an app key credential
> Note: To update an Application with the newly generated key credential, use the Replace an Application request with the new credentials.signing.kid value in the request body. You can provide just the Signing Credential object instead of the entire Application Credential object.
clone_application_keyexectargetAid, subdomainClones an X.509 certificate for an Application Key Credential from a source app to a target app.

For step-by-step instructions to clone a credential, see Share application key credentials for IdPs across apps.
> Note: Sharing certificates isn't a recommended security practice.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
subdomainstringThe domain of your organization. This can be a provided subdomain of an official okta domain (okta.com, oktapreview.com, etc) or one of your configured custom domains. (default: my-org)
targetAidstringUnique key of the target Application
validityYearsintegerExpiry years of the Application Key Credential

SELECT examples

Lists all key credentials for an app

SELECT
created,
e,
expiresAt,
kid,
kty,
lastUpdated,
n,
use,
x5c,
x5t#S256
FROM okta.apps.keys
WHERE subdomain = '{{ subdomain }}' -- required;

INSERT examples

Generates a new X.509 certificate for an app key credential
> Note: To update an Application with the newly generated key credential, use the Replace an Application request with the new credentials.signing.kid value in the request body. You can provide just the Signing Credential object instead of the entire Application Credential object.

INSERT INTO okta.apps.keys (
validityYears,
subdomain
)
SELECT
'{{ validityYears }}',
'{{ subdomain }}'
RETURNING
created,
e,
expiresAt,
kid,
kty,
lastUpdated,
n,
use,
x5c,
x5t#S256
;

Lifecycle Methods

Clones an X.509 certificate for an Application Key Credential from a source app to a target app.

For step-by-step instructions to clone a credential, see Share application key credentials for IdPs across apps.
> Note: Sharing certificates isn't a recommended security practice.

EXEC okta.apps.keys.clone_application_key 
@targetAid='{{ targetAid }}' --required,
@subdomain='{{ subdomain }}' --required;