# Simple OKTA-SAML authentication using JAVA API REST

**URL:** <https://devforum.okta.com/t/simple-okta-saml-authentication-using-java-api-rest/5590>\
**Category:** SAML\
**Created:** [July 8, 2019, 6:27pm UTC](https://devforum.okta.com/t/simple-okta-saml-authentication-using-java-api-rest/5590 "2019-07-08T18:27:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TrustedAuth](https://avatars.discourse-cdn.com/v4/letter/t/bcef8e/32.png) [@TrustedAuth](https://devforum.okta.com/u/TrustedAuth)\
**Post date:** [July 8, 2019, 6:27pm UTC](https://devforum.okta.com/t/simple-okta-saml-authentication-using-java-api-rest/5590/1 "2019-07-08T18:27:24Z")

</div>

Hi,

I am very new to Java and OKTA (I am a systems admin).

We have an application running on WebSphere and already it’s configured to be trusted by Okta. The problem is that, in certain Workflows, we need to call a pop-up window requesting user and password to confirm an action (required by the FDA) using Java.

I am thinking of using Java and do a POST to /api/v1/authn, sending the parameters in Json format.

BUT I am not sure where to start, which .jars should I download?

I was trying using [GitHub - okta/okta-auth-java: okta-auth-java](https://github.com/okta/okta-auth-java), but I have problems big time trying to resolve all the missing dependencies and I was expecting to include a simple .jar (not all the .javas included there) and call these functions:

```
	Client client = Clients.builder()
			.setOrgUrl("https://myURL.com")
			.setClientCredentials(new TokenClientCredentials("SomeAPIkey"))
			.build();

```

client.authenticate(“user”, “password”, “RelayState”, “stateHandler”);

In the name of God, I present here my help request, please help me.

---

<div class="post-metadata">

**Author:** ![bdemers](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/bdemers/32/23_2.png) [@bdemers](https://devforum.okta.com/u/bdemers)\
**Post date:** [July 11, 2019, 6:53pm UTC](https://devforum.okta.com/t/simple-okta-saml-authentication-using-java-api-rest/5590/2 "2019-07-11T18:53:07Z")

</div>

Hey @TrustedAuth!

The new to Java might be the biggest hurdle. I’d recommend using Apache Maven to manage your dependencies. We have an example project here:

> **[okta/samples-java-servlet](https://github.com/okta/samples-java-servlet/tree/master/authn-servlet)**
>
> samples-java-servlet. Contribute to okta/samples-java-servlet development by creating an account on GitHub.

That said, I almost always recommend people try to see if an OIDC/OAuth2 option works for you before trying to use the Authentication API (with great power…). I cannot say if that would work for you given your FDA requirements.  
We have a bunch of getting started with Spring Boot + OAuth posts on the [Okta Blog](https://www.google.com/search?q=site%3Adeveloper.okta.com%2Fblog+spring+boot+okta):

I’d suggest you reach out to Okta support or sales, they can help you with some of those types of requirements too.

---

<div class="post-metadata">

**Author:** ![TrustedAuth](https://avatars.discourse-cdn.com/v4/letter/t/bcef8e/32.png) [@TrustedAuth](https://devforum.okta.com/u/TrustedAuth)\
**Post date:** [July 12, 2019, 3:46pm UTC](https://devforum.okta.com/t/simple-okta-saml-authentication-using-java-api-rest/5590/3 "2019-07-12T15:46:27Z")

</div>

Thank you bdemers,

I recreated the project as Maven project and included the dependencies there and the .jars were magically downloaded.

Now the function works.

Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [January 17, 2024, 11:45pm UTC](https://devforum.okta.com/t/simple-okta-saml-authentication-using-java-api-rest/5590/4 "2024-01-17T23:45:40Z")

</div>

Closed on January 17, 2024, 11:45pm UTC

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