-
Notifications
You must be signed in to change notification settings - Fork 135
Creating a Client
Brian Demers edited this page Jan 25, 2018
·
9 revisions
The easiest way to get started is to create a config file ~/.okta/okta.yaml
that contains your organization URL and API token:
okta:
client:
token: <your-super-secret-api-token>
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:
Client client = Clients.builder().build();
Or you can configure these attributes programmatically as well:
Client client = Clients.builder()
.setClientCredentials(new TokenClientCredentials("<your-super-secret-api-token>"))
.setOrgUrl("https://dev-123456.oktapreview.com)
.build();
Now that you have a client, start using it:
client.listUsers()
Configuration values are discovered in a hierarchical manor (where each layer can overwrite the previous)
classpath:com/okta/sdk/config/okta.yaml
classpath:okta.yaml
$HOME/.okta/okta.yaml
- Environment Variables (with dot notation converted to uppercase + underscores)
- JVM System Properties
- Programmatically i.e.
Clients.builder()
If you are using the Okta Spring Boot Starter configuration properties are loaded via Spring's environment in this order:
$HOME/.okta/okta.yaml
$HOME/.okta/okta.yml
- Standard Spring Boot External Config resolution
okta:
client:
token: <string>
orgUrl: <string>
connectionTimeout: <int> # of seconds
proxy:
port: <int>
host: <string>
username: <string>
password: <string>
okta.client.token: <string>
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>
OKTA_CLIENT_TOKEN: <string>
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>