代码之家  ›  专栏  ›  技术社区  ›  raj

部署在tomcat上的angular 4应用程序在okta身份验证后未正确重新路由

  •  0
  • raj  · 技术社区  · 7 年前

    我已经在tomcat服务器上部署了angular 4应用程序,但在使用okta进行身份验证后,即使我使用 navigateByUrl()

    但在运行ng-serve命令时,这同样适用于节点js。

    showProductsPage(){ 
       this.router.navigateByUrl('/products');}  
       showLogin() {
          this.oktaSignIn.renderEl({el: '#okta-login-container'}, (response) 
          if (response.status === 'SUCCESS') {
            this.user = response.claims.email;
            this.oktaSignIn.session.get((sessionResponse) => {
                this.userId = sessionResponse.login.indexOf('@') > -1 ? sessionResponse.login.split("@")[0] : sessionResponse.login;
                localStorage.setItem('tkid',this.userId);
                this.showProductsPage();
                //this.router.navigate(['products']);
            }); 
        }
    

    我尝试了HashLocationStrategy,但不确定它在这种情况下如何帮助我

    1 回复  |  直到 7 年前
        1
  •  0
  •   raj    7 年前

    我已实施

    从“@角度/公共”导入{HashLocationStrategy,LocationStrategy}; -useHash:在导入中为true -{提供:LocationStrategy,useClass:HashLocationStrategy}

    基本上这是okta方面的一个错误,但使用HashLocationStrategy我解决了这个问题