I’m trying to find examples of the Okta API to search for users, not for Authentication, just to get their name, userid, and e-mail address for Person Search functionality. My application is in Grails and I’m getting java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request. After putting in what I thought would be the proper code. Any information I can get on setting up the API calls properly. I only need it for user searches.
Have you looked at our API docs for the Users endpoint?
Yes, I’ve looked at that, but that tells me how to use the API. I’m looking for what libraries I need to use to get the API calls. Something like this
Clients client = Clients.builder() .setOrgUrl(OKTA_ORG_URL) .setClientCredentials(new TokenClientCredentials(OKTA_SECRET)) .build() UserApi userApi = new UserApi(client); User user = userApi.getUser("userId")
Ah, so you’re looking at the Java Management SDK? You can find its docs here if that helps: Okta Java SDK 10.2.0 API. You will likely want to use listUsers with a search or filter to target the desired users
Thank you, that should help.
I’m getting that it can’t find import com.okta.sdk.client.Client in my IDE, but I see references to that library in several places. Am I missing something that is needed in my gradle or is it version number issue?
implementation 'org.grails.plugins:spring-security-oauth2:2.0.0-RC1' implementation 'com.okta.spring:okta-spring-security-oauth2:3.0.2' implementation 'com.okta.sdk:okta-sdk-api:10.2.0' runtime 'com.okta.sdk:okta-sdk-impl:10.2.0'