Skip to content

Creating a Client

Brian Demers edited this page Apr 17, 2018 · 1 revision

The easiest way to get started is to create a config file ~/.okta/okta.yaml that contains your organization URL:

okta:
  client:
    orgUrl: https://dev-123456.oktapreview.com

Now that you have define the two require fields, you can create a client with a single line of code:

AuthenticationClient client = AuthenticationClients.builder().build();

Or you can configure these attributes programmatically as well:

AuthenticationClient client = ClieAuthenticationClientsts.builder()
        .setOrgUrl("https://dev-123456.oktapreview.com)
        .build();

Now that you have a client, start using it:

client.authenticate(...);

Configuration

Configuration values are discovered in a hierarchical manor (where each layer can overwrite the previous)

  1. classpath:com/okta/sdk/config/okta.yaml
  2. classpath:okta.yaml
  3. $HOME/.okta/okta.yaml
  4. Environment Variables (with dot notation converted to uppercase + underscores)
  5. JVM System Properties
  6. Programmatically i.e. Clients.builder()

okta.yaml Reference:

okta:
  client:
    orgUrl: <string>
    connectionTimeout: <int> # of seconds
    proxy:
      port: <int>
      host: <string>
      username: <string>
      password: <string>

System Property Reference:

okta.client.orgUrl: <string>
okta.client.connectionTimeout: <int> # of seconds
okta.client.proxy.port: <int>
okta.client.proxy.host: <string>
okta.client.proxy.username: <string>
okta.client.proxy.password: <string>

Environment Variables Reference:

OKTA_CLIENT_ORGURL: <string>
OKTA_CLIENT_CONNECTIONTIMEOUT: <int> # of seconds
OKTA_CLIENT_PROXY_PORT: <int>
OKTA_CLIENT_PROXY_HOST: <string>
OKTA_CLIENT_PROXY_USERNAME: <string>
OKTA_CLIENT_PROXY_PASSWORD: <string>
Clone this wiki locally