stormpath-sdk-java icon indicating copy to clipboard operation
stormpath-sdk-java copied to clipboard

Different setting when Stormpath project use Okta api

Open weidongdiao opened this issue 8 years ago • 5 comments

When my Stormpath project want to use Okta API, besides changing the version from "0.0.7-SNAPSHOT" to "2.0.0-okta", do I need to make other changes? Because after I change the version and set Okta environment variables, it has error shows like that:

Caused by: java.lang.IllegalStateException: Unable to find an API Key 'id', either from explicit configuration (for example, ApiKeyBuilder.setApiKeyId) or from fallback locations:

  1. system property stormpath.client.apiKey.id
  2. resource file path or URL specified by system property stormpath.client.apiKey.file
  3. resource file path or URL specified by environment variable STORMPATH_API_KEY_FILE
  4. environment variable STORMPATH_API_KEY_ID
  5. default apiKey.properties file location /Users/weidongdiao/.stormpath/apiKey.properties.

Here's my pom.xml file: <groupId>com.xxx</groupId> <artifactId>xxxx</artifactId> 2.0.0-okta jar

So how can I solve this problem?

weidongdiao avatar Jul 24 '17 02:07 weidongdiao

Please see our Getting Started with Okta guide on how to make your app work with Okta.

This tutorial on our developer blog also shows how to make it work.

mraible avatar Jul 24 '17 15:07 mraible

Getting Started with Okta doesn't work anymore for Spring Boot if you follow it to the letter. The Okta UI has changed for one thing, more importantly - see issue #1346.

trautvetter avatar Aug 01 '17 09:08 trautvetter

After following the tutorial, I make some change in my pom.xml file. I update the version of com.stormpath.spring showed as followed: <groupId>com.stormpath.spring</groupId> <artifactId>stormpath-default-spring-boot-starter</artifactId> 2.0.0-okta

Then it has errors that happened in my Roles file, the error is "Exception: A granted authority textual representation is required".

Here's my code in the Roles file: import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.stereotype.Component;

@Component public class Roles { public final GrantedAuthority ROLE_ADMIN;

@Autowired
public Roles(Environment env) {
    ROLE_ADMIN = new SimpleGrantedAuthority(env.getProperty("stormpath.authorized.group.admin"));
}

}

I really have no idea how to solve it.

weidongdiao avatar Aug 01 '17 20:08 weidongdiao

@weidongdiao Were you able to solve this issue?

mraible avatar Aug 15 '17 18:08 mraible

Hi, Matt,

Because in Okta API, it just needs three environment variables: stormpath_base_url, okta_api_token and okta_application_id. So I just change "stormpath.authorized.group.admin" to "okta_application_id". So this problem has solved. However, it comes another problem, showed that "Caused by java.lang.UnsupportedOperationException: newIdSiteUrlBuilder() method hasn't been implemented."

I have no idea how to solve that.

weidongdiao avatar Aug 15 '17 19:08 weidongdiao