yush
yush

Reputation: 426

Okta: How to retrieve Access Token via SessionToken (JavaScript)

Im able to fetch the "sessionToken" via the Okta API, however how am I able to retrieve the AccessToken with the "sessionToken"?

I am using the JS SDK: https://github.com/okta/okta-auth-js

let oktaConfig2 = {
  issuer: "https://{OKTA_DOMAIN}/oauth2/default/v1/authorize"
};

const oktaAuth2 = new OktaAuth(oktaConfig2);

    oktaAuth2.token
      .getWithoutPrompt({
        responseType: "id_token",
        sessionToken: sessionToken2,
      })
      .then(function (data2) {
        console.log(data2);
      });

I receive an error 404 in the response.

Any ideas?

TIA

Upvotes: 2

Views: 2711

Answers (1)

Tennyx
Tennyx

Reputation: 153

Remove the /v1/authorize from the issuer value and it should take care of the 404.

Upvotes: 2

Related Questions