# Okta API and service app

**URL:** <https://devforum.okta.com/t/okta-api-and-service-app/24175>\
**Category:** API\
**Created:** [May 6, 2023, 5:30pm UTC](https://devforum.okta.com/t/okta-api-and-service-app/24175 "2023-05-06T17:30:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anu](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@anu](https://devforum.okta.com/u/anu)\
**Post date:** [May 6, 2023, 5:30pm UTC](https://devforum.okta.com/t/okta-api-and-service-app/24175/1 "2023-05-06T17:30:36Z")

</div>

Hi,

I am trying to create a service app in Okta to test a server side java application to call Okta Users API to read user profile. In this case, should I use client ID/secret method or public/private key?

In what scenarios the Client Credentials “Client authentication” ‘client secret’ method vs ‘Public key / Private key’ method is used?

And should I use Okta java SDK to call the Okta Users API?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![phi1ipp](https://avatars.discourse-cdn.com/v4/letter/p/85f322/32.png) [@phi1ipp](https://devforum.okta.com/u/phi1ipp)\
**Post date:** [May 6, 2023, 10:58pm UTC](https://devforum.okta.com/t/okta-api-and-service-app/24175/2 "2023-05-06T22:58:04Z")

</div>

Okta Users API will only be available to your with OAuth2 access\_token obtained through a service app with private\_key\_jwt authentication method.

It’s a matter of your preference if you want to include Okta SDK or build your HTTP API calls with low level HTTPClient library. For Okta it does not matter how the request is prepared. I’d suggest to go with the SDK, as it’s more convenient. If the size of the binary is your concern then you may choose going with manual (HTTPClient) request preparation

---

<div class="post-metadata">

**Author:** ![anu](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@anu](https://devforum.okta.com/u/anu)\
**Post date:** [May 7, 2023, 2:50pm UTC](https://devforum.okta.com/t/okta-api-and-service-app/24175/4 "2023-05-07T14:50:49Z")

</div>

Thanks for your response. Could you please clarify when the client secret method is used through service app?

---

<div class="post-metadata">

**Author:** ![alisaduncan](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/alisaduncan/32/3429_2.png) [@alisaduncan](https://devforum.okta.com/u/alisaduncan)\
**Post date:** [May 8, 2023, 10:20pm UTC](https://devforum.okta.com/t/okta-api-and-service-app/24175/5 "2023-05-08T22:20:38Z")

</div>

Hey @anu !

The authorization method is dependent on your Okta org setup. If you use an Okta Developer Edition org, use the JWKS method.

You can read more about it on [Selecting the Best Authorization for your API Integrations](https://developer.okta.com/blog/2023/04/24/api-integrations).

Hope this clarifies things. Happy coding!

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [February 14, 2024, 4:58pm UTC](https://devforum.okta.com/t/okta-api-and-service-app/24175/6 "2024-02-14T16:58:24Z")

</div>

Closed on February 14, 2024, 4:58pm UTC


