I’m using Angular SPA with Okta sign-in widget. I have configured app-level MFA (Org-level MFA not configured.) When using showSignInAndRedirect() code flow it is redirecting to okta page for MFA and once successfully authenticated it comes back to login/callback route then redirect to login page and thereon not redirecting to home page. I’m sure missing something here on the redirect section.
this.signIn = new OktaSignIn({
baseUrl: envConfig.oidc.issuer.split('/oauth2')[0],
clientId: envConfig.oidc.clientId,
redirectUri: envConfig.oidc.redirectUri,
logo: '/assets/images/logo.svg',
i18n: {
en: {
'primaryauth.title': 'Sign in',
},
},
authParams: {
pkce: true,
issuer: envConfig.oidc.issuer,
scopes: envConfig.oidc.scopes,
},
prompt: "login"
});
this.signIn.showSignInToGetTokens({
el: '#sign-in-widget',
scopes: envConfig.oidc.scopes
}).then(async tokens => {
// When navigating to a protected route, the route path will be saved as the `originalUri`
// If no `originalUri` has been saved, then redirect back to the app root
const originalUri = this.oktaAuth.getOriginalUri();
if (originalUri === DEFAULT_ORIGINAL_URI) {
this.oktaAuth.setOriginalUri('/');
}
// Remove the widget
this.signIn.remove();
// In this flow the redirect to Okta occurs in a hidden iframe
this.oktaAuth.handleLoginRedirect(tokens);
}).catch(err => {
// Typically due to misconfiguration
throw err;
});
Please share if there is working sample available for showSignInAndRedirect() code flow for angular SPA.