Java Sample Code Add a new user using User API

I am looking for Java Sample Code to Add a new user using User using Okta API within my Spring application

We have documentation in github:

thanks a lot… I will try this.

I have one question… What should I do If I want to access below properties from my application.yaml. Also is is the same token, that I generated and used to run API in postman? Is there any way to fetch it from Okta instead of hard coding this?

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

Hey @mjuneja!

As of the latest version of the okta-spring-boot-starter you can just inject the Client.

You shouldn’t need direct access to those properties (if you inject the client). To answer your question though, if you want to inject one of those properties you can use a Spring @Value annotation, something like: @Value("#{environment.SOME_KEY_PROPERTY}"). Or with you can inject the configuration object OktaClientProperties (when using the latest version).

Let us know if that doesn’t answer your question!
-Brian

2 Likes

Yes. This worked.
Thanks a lot.

1 Like

Can we search groups by group Names using API?

Yes, see the documentation for List/Search Groups: https://developer.okta.com/docs/api/resources/groups#search-groups

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.