简体   繁体   English

Okta 登录页面在用户身份验证后进入无限循环

[英]Okta login page goes to infinite loop after user authentication

在此处输入图像描述

like this像这样

My Angular app integrated Okta access and user management API. The application backend is hosted in AWS Beanstaik and front end angular app is hosted S3.我的 Angular 应用程序集成了 Okta 访问和用户管理 API。应用程序后端托管在 AWS Beanstaik 中,前端 angular 应用程序托管在 S3 中。

I checked the.network response by chrome dev tools and I got this我通过 chrome 开发工具检查了 .network 响应,我得到了这个

{"expiresAt":"2021-09-03T02:59:39.000Z","status":"SUCCESS","sessionToken":"20111F_ApSDB7zPMeay5y2V4nG8yUlU0i4ICgHyAOMYvc5Miq743wse","_embedded":{"user":{"id":"00ubopju1CRuT02ji5d6","passwordChanged":"2021-03-13T22:58:33.000Z","profile":{"login":"Rafi12534@Gmail.com","firstName":"Mohammed","lastName":"Samsuddin","locale":"en","timeZone":"America/Los_Angeles"}}},"_links":{"cancel":{"href":"https://dev-97379822.okta.com/api/v1/authn/cancel","hints":{"allow":["POST"]}}}}

login component code:登录组件代码:

import { Component, OnInit } from '@angular/core';
import { OktaAuthService } from '@okta/okta-angular';
import * as OktaSignIn from '@okta/okta-signin-widget';



import myAppConfig  from '../../config/my-app-config';

@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {

  oktaSignin: any;

  constructor(private oktaAuthService: OktaAuthService) {

    this.oktaSignin = new OktaSignIn({
      logo: 'assets/images/logo_for_favicon.png',
      features: {
        registration: true
      },
      baseUrl: myAppConfig.oidc.issuer.split('/oauth2')[0], // return everything in url before '/oauth2'
      clientId: myAppConfig.oidc.clientId,
      redirectUri: myAppConfig.oidc.redirectUri,
      authParams: {
        pkce: true,         // Proof Key for Code Exchange.
                            // Proof Key for Code Exchange (PKCE, pronounced pixie) 
                            // extension describes a technique for public clients to mitigate
                            // the threat of having the authorization code intercepted.
        issuer: myAppConfig.oidc.issuer,
        scopes: myAppConfig.oidc.scopes
      }
    });


   }



  ngOnInit(): void {

    this.oktaSignin.remove();   // remove previous element that rendered there

    this.oktaSignin.renderEl({
      el: '#okta-sign-in-widget'}, // render element with given id
                                  // this name should be same as div tag id in login.component.html
      (response) => {
        if (response.status === "SUCCESS") {
          this.oktaAuthService.signInWithRedirect();
        }
      },
      (error) => {
        throw error;
      }
    );
  }

}


After authentication okta try to authenticate again that's what maybe put it into infinite loop.身份验证后,okta 尝试再次进行身份验证,这可能会使它陷入无限循环。

I had the same problem and I solve it like this:我有同样的问题,我是这样解决的:

In the my-app-config file in your case, Its probably configured like that, pointing localhost in the redirectUri:在你的 my-app-config 文件中,它可能是这样配置的,在 redirectUri 中指向本地主机: 它可能是这样配置的,在 redirectUri 中指向 localhost

Just change it to your real url for example:只需将其更改为您的真实 url 例如:

   redirectUri: 'http://example.com/login/callback'

And it should resolve the auth loop.它应该解决身份验证循环。

I hope that solves the problem for you!我希望这能为您解决问题!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 flutter 中通过身份验证后将用户从登录/注册页面导航到主页的正确方法 - Proper way of navigating user from login/signup page to home page after authentication in flutter 引入应用程序网关后 WebApp 和 AAD 身份验证之间的无限循环 - Infinite Loop between WebApp and AAD Authentication after introducing Application Gateway Firebase 登录/注册后无限加载 - Firebase Infinite Loading after Login/Register firebase 应用程序中的身份验证流程问题 - 登录后,活动用户最初返回为 null - Problems with authentication flow in firebase app - after login, active user initially returns as null 即使在具有 firebase 身份验证的 nextjs 应用程序中重新加载页面后,如何保持用户登录? - how can I keep a user looged in even after page reload in nextjs app with firebase authentication? 重新加载私有路由页面后,用户将被重定向到登录页面。 [反应路由器] - after reloading the page of a private route, the user is redirected to the login page. [react router] Api登录msal认证后调用 - Api call after login msal authentication FabricGateway.exe 在服务器重启后进入启动循环 - FabricGateway.exe goes into a boot loop after a server reboot 使用 Lambda、Cognito 或 IAM 在 AWS 上进行用户身份验证(注册和登录) - User Authentication (Signup & Login) on AWS with Lambda, Cognito or IAM 在 angular 应用程序中注销后重定向到登录页面 - Redirect to login page after logout in angular app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM