Okta "The Requested feature is not enabled in this enviroment"

Hello, I am working on custom integrations with apps with Okta, I’m a little new to the system so I’m still working out all the details, I am working on code that is suppost to send me to an authentication server through a widget (Single Page App, PKCE required and implicit is enabled in grant type) but I keep getting the error “The requested feature is not enabled in this enviroment” been trying for a few days to fix this with no dice. Here is my code below:

<!doctype html>

Simple Web Page h1 { margin: 2em 0; }
<div class="container">
    <div id="okta-login-container"></div>
</div>

<script type="text/javascript">

var oktaSignIn = new OktaSignIn({
baseUrl: “https://MYid.okta.com”,
clientId: “clientID”,
authParams: {
issuer: “https://MYid.okta.com/oauth2/default”,
responseType: [‘token’, ‘id_token’],
display: ‘page’
}
});

if (oktaSignIn.token.hasTokensInUrl()) {
oktaSignIn.token.parseTokensFromUrl(
// Interact with authentication server if they attempt to sign in.
function success(res) {
var accessToken = res[0];
var idToken = res[1];

    oktaSignIn.tokenManager.add('accessToken', accessToken);
    oktaSignIn.tokenManager.add('idToken', idToken);

    window.location.hash='';
    },
  function error(err) {
    console.error(err);
  }
);

} else {
oktaSignIn.session.get(function (res) {
// Let use know of active user sessin if they’re still logged in.
if (res.status === ‘ACTIVE’) {
document.getElementById(“messageBox”).innerHTML = "Hello, " + res.login + “! You are still logged in! :)”;
return;
}
// If the user is not logged in, then render new login widget.
oktaSignIn.renderEl(
{ el: ‘#okta-login-container’ },
function success(res) {},
function error(err) {
console.error(err);
}
);
});
}

Note: I replace the ID and Links in this code. Within the code they’re my reals ones.

try changing the issuer to just https://MYid.okta.com, adding /oauth2/default refers to the Default Authorization Server (associated with the API Access Management feature), which the org you are using doesn’t seem to have. Instead, you’ll have to use the Org Authorization Server.

If you want more details, we have a video about this distinction here: Okta Authorization Servers for OpenID Connect and OAuth 2.0 Integrations - YouTube

1 Like

Hello! So I did it but I just get an error that I need to have a login redirect URI

Hi @JohnIGonza! Can you try adding a login redirect parameter aka redirectUri: per - GitHub - okta/okta-signin-widget: HTML/CSS/JS widget that provides out-of-the-box authentication UX for your organization's apps.

1 Like

SPOT ON! Thanks man! It worked!

1 Like

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