Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@okta/configuration-validation

okta113.7kApache-2.01.1.0TypeScript support: included

Configuration validation support for Okta JavaScript SDKs

okta, oidc, OpenID Connect, authentication, auth, oauth2

readme

Okta Configuration Validation

Standard pattern for validating configuration passed into Okta JavaScript libraries and SDKs.

Installation

npm install --save @okta/configuration-validation

API

assertIssuer(issuer, [, testing])

Assert that a valid issuer was provided.

// Valid
assertIssuer('https://example.okta.com');

// Throws a ConfigurationValidationError
//
// It looks like there's a typo in your Okta domain!
assertIssuer('http://foo.com.com');

// Ignore HTTPS requirement for testing
assertIssuer('http://localhost:8080/', {
  disableHttpsCheck: true
});

assertClientId(clientId)

Assert that a valid clientId was provided.

assertClientId('abc123');

assertClientSecret(clientSecret)

Assert that a valid clientSecret was provided.

assertClientSecret('superSecret');

assertRedirectUri(redirectUri)

Assert that a valid redirectUri was provided.

assertRedirectUri('https://example.com/callback');

assertAppBaseUrl(appBaseUrl)

Assert that a valid appBaseUrl was provided.

assertAppBaseUrl('https://example.com');

Contributing

We welcome contributions to all of our open-source packages. Please see the contribution guide to understand how to structure a contribution.

Installing dependencies for contributions

We use yarn for dependency management when developing this package:

yarn install

changelog

1.1.0

Features

  • #954
    • Adds ES entry point for configuration-validation
    • Adds sourcemaps

Other

  • #1052 Fixes vulnerability issues

1.0.0

Features

  • #879 Adds support for Typescript

0.4.3

Bug Fixes

  • #818 Remove bad regex for domain typo checking

0.4.2

Bug Fixes

  • [#754] autoRenew: false at the top of a config (not in tokenManager) now actually passes into tokenManager. The previous behavior caused problems with libraries (such as @okta/okta-auth-js) that tried to assign defaults of true to any params not explicitly set, as they would not see any explictly false setting.

0.4.1

Bug Fixes

  • a2a7b3e - Normalize config format for the properties responseType and scopes, used in get token flows.

0.4.0

Features

  • 654550 - All configuration options are now accepted. See Configuration Reference. Camel-case (clientId) is now the preferred syntax for all Okta OIDC libraries. Underscore syntax (client_id) may be deprecated in a future release.

0.3.0

Features

  • 9b04ada - Adds buildConfigObject function which accepts both camelCase and underscore_case

0.2.0

Features

  • 035607b - Adds assertion function for appBaseUrl

0.1.1

Bug Fixes

  • 49e8f60 - Use babel to compile for IE 11