Get ID Token from active session for REST

I have a use case of invoking a REST API for an Okta App by passing a JWT token. The REST endpoint will be invoked within browser javascript of another Okta app while the user performs a certain action.

How can I retrieve the ID Token in browser js from an active user session.

If you are using the widget, it stores tokens which you can access.
signIn.tokenManager

(where signin is the variable of your initiated Okta widget).

I am not using a widget. The user will be already logged into the application (Quickbase). I need to invoke REST endpoint of another application (Oracle) from a Javascript which is invoked from a Quickbase button action.

The user subject is available in Oracle as well. The specification for Oracle REST requires a JWT token.

In your web app, are you using a library to get access/id tokens or are you making the calls yourself?

There is no custom web-app involved within this. The user logs into a Quickbase application. When the user clicks on a specific button we have access to execute custom javascript through which I need to invoke a REST endpoint in an Oracle saas application. The Oracle specification requires a JWT token for authentication.

Both the applications use Okta as ID Provider and the user is setup in both the systems.

So I wanted to know how I can get the JWT token from custom javascript within Quickbase when the user session is already active. Shold I invoke the Okta authorize endpoint with scope openid without any redirect ?