stormpath / stormpath-sdk-java

Official Java SDK for the Stormpath User Management REST API
222 stars 155 forks source link

Okta branch client configuration #1332

Open mdeggies opened 7 years ago

mdeggies commented 7 years ago

I'm having trouble creating a client with 2.0.0-okta-rc1. I wanted to add this to a GH issue in case others are having the same problem.

The pom.xml file contains these dependencies:

        <dependency>
            <groupId>com.stormpath.sdk</groupId>
            <artifactId>stormpath-sdk-api</artifactId>
            <version>2.0.0-okta-rc1</version>
        </dependency>
        <dependency>
            <groupId>com.stormpath.sdk</groupId>
            <artifactId>stormpath-sdk-httpclient</artifactId>
            <version>2.0.0-okta-rc1</version>
            <scope>runtime</scope>
        </dependency>

I tried a couple of different things. They all result in the same exception:

Exception in thread "main" java.lang.IllegalStateException: Unable to load credentials from any provider in the chain.
    at com.stormpath.sdk.impl.authc.credentials.ClientCredentialsProviderChain.getClientCredentials(ClientCredentialsProviderChain.java:55)
    at com.stormpath.sdk.impl.client.DefaultClientBuilder.build(DefaultClientBuilder.java:314)
    at quickstart.oktaRC.main(oktaRC.java:13)
  1. Added the following environment variables to Intellij (note- these are example/fake values):

STORMPATH_CLIENT_BASEURL=https://dev-55462823.oktapreview.com;OKTA_APPLICATION_ID=0oaaahvk62tXGkyQk0h7;OKTA_API_TOKEN=0GF9H-ASq49SS-6py4RODBFKgxkU_cxWFhtM-LeqDv;STORMPATH_CLIENT_APIKEY_ID=1EVE7LMD9K04T80C7WEV8606P;STORMPATH_CLIENT_APIKEY_SECRET=MYz5CoS+Hsjmzr0K3DF9RYt49hbmEp3xJ499oTsX1d8

Tried the same without STORMPATH_CLIENT_APIKEY_ID and STORMPATH_CLIENT_APIKEY_SECRET defined.

  1. Added the following variables to my ~/.stormpath/apiKey.properties file:
stormpath.client.baseurl=https://dev-55462823.oktapreview.com
okta.application.id=OKTA_APPLICATION_ID=0oaaahvk62tXGkyQk0h7;OKTA_API_TOKEN=0GF9H-ASq49SS-6py4RODBFKgxkU_cxWFhtM-LeqDv
okta.api.token=00iUzV-aAem58RMKo77qSO9MJdpe1EMOdg36eAeHY6
stormpath.client.apiKey.id=1EVE7LMD9K04T80C7WEV8606P
stormpath.client.apiKey.secret=MYz5CoS+Hsjmzr0K3DF9RYt49hbmEp3xJ499oTsX1d8

Tried the same without stormpath.client.apiKey.id and stormpath.client.apiKey.secret defined.

My tester class is very simple:

import com.stormpath.sdk.client.Client;
import com.stormpath.sdk.client.ClientBuilder;
import com.stormpath.sdk.client.Clients;

public class oktaRC {

    public static void main(String[] args) {
        ClientBuilder builder = Clients.builder();
        Client client = builder.build();

    }
}
ved230609 commented 6 years ago

were you able to fix this? I am also facing similar issue. Any help appreciated