首页 > 解决方案 > Auth0-lock 不会显示关闭按钮角度

问题描述

我一直在尝试将 auth0-lock 小部件添加到我的 Angular 应用程序中,它工作得很好,但是当涉及到 ui 自定义时,即使我添加了选项 closable: true 也不会出现关闭按钮。这是我的代码:

import {Auth0Lock} from 'auth0-lock'

constructor(private router: Router, private cookie: CookieService, private http: HttpClient){
  this.lock.on("authenticated", (authResult: any) => {
    this.lock.getProfile(authResult.accessToken, async (error: any, profile: any) => {
      if (error) throw new Error('error');
      // code
    });
  });
}
auth0Options = {
  closable: true,
  theme: {
    primaryColor: '#DFA612'
  },
  auth: {
    redirectUrl: environment.auth0.callbackURL,
    responseType: 'token id_token',
    audience: `https://${environment.auth0.domain}/userinfo`,
    params: {
      scope: 'openid profile email'
    }
  },
  autoclose: true
};
lock = new Auth0Lock(
  environment.auth0.clientId,
  environment.auth0.domain,
  this.auth0Options
)
login(){
  this.lock.show()
}
logout(){
  this.lock.logout();
  //code
}

请问有什么帮助吗?先感谢您。

PS:一切正常,我唯一的问题是它无法关闭。

标签: angularauth0-lock

解决方案


样式有问题,我不得不覆盖关闭按钮 css 类,.auth0-lock-close-button并将其设置z-index为更高的值。


推荐阅读