# Cross application REST using JWT

**URL:** <https://devforum.okta.com/t/cross-application-rest-using-jwt/9100>\
**Category:** Questions\
**Created:** [April 27, 2020, 3:06pm UTC](https://devforum.okta.com/t/cross-application-rest-using-jwt/9100 "2020-04-27T15:06:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![isbansal](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/isbansal/32/1811_2.png) [@isbansal](https://devforum.okta.com/u/isbansal)\
**Post date:** [April 27, 2020, 3:06pm UTC](https://devforum.okta.com/t/cross-application-rest-using-jwt/9100/1 "2020-04-27T15:06:57Z")

</div>

I have 2 SP’s configured with Okta. User is logged into one of the SP’s. Can I consume the REST endpoint on the other SP using a JWT token as per that SP’s specification. I have access to embed custom Javascript in the authenticated SP from where I have a requirement to get some data from the other SP.

---

<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:** [April 28, 2020, 1:04am UTC](https://devforum.okta.com/t/cross-application-rest-using-jwt/9100/2 "2020-04-28T01:04:23Z")

</div>

it depends… if they use the same authorization server, then I’d say yes, if the subject is assigned to the remote application as well.

---

<div class="post-metadata">

**Author:** ![isbansal](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/isbansal/32/1811_2.png) [@isbansal](https://devforum.okta.com/u/isbansal)\
**Post date:** [April 28, 2020, 8:28am UTC](https://devforum.okta.com/t/cross-application-rest-using-jwt/9100/3 "2020-04-28T08:28:22Z")

</div>

I do not have admin access to verify the authorization server however in my okta home page, I can see both the apps (SP1 & SP2). Also in by browser, when I am logged into the first SP, I am not asked to login again for SP2. So I guess that both are using the same authorization server.

The subject is also available in both the applications.

Can you suggest how I can generate custom JWT from a frontent javascript snippet within an application to invoke a REST endpoint of the other application. The user is already logged into the frontend application and the same subject is available in the REST endpoint application.

There is also a section within the custom JWT to sign the payload with private key. Would that be possible in javascript and is it secure ? I’m assuming this would need to be done at the server side and if that’s the case, how can I achieve that using okta ?

---

<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:** [January 23, 2024, 11:24pm UTC](https://devforum.okta.com/t/cross-application-rest-using-jwt/9100/4 "2024-01-23T23:24:58Z")

</div>


