[英]Auth0 login in a modal window in Node.js app
just started with node.js and auth0. 刚开始使用node.js和auth0。 have followed this guide on auth0 website - Build and Authenticate a Node Js App with JSON Web Tokens
在auth0网站上已遵循本指南- 使用JSON Web令牌构建和验证Node Js应用
I am using ejs as my template engine, here is the login router: 我使用ejs作为模板引擎,这是登录路由器:
router.get('/login',function(req, res){
res.render('login', { env: env });
});
And the login.html view: 和login.html视图:
<div id="root" style="width: 280px; margin: 40px auto; padding: 10px;">
<script src="https://cdn.auth0.com/js/lock/10.12.1/lock.min.js"></script>
<script>
var lock = new Auth0Lock('<%= env.AUTH0_CLIENT_ID %>', '<%= env.AUTH0_DOMAIN %>', { auth: {
redirectUrl: '<%= env.AUTH0_CALLBACK_URL %>'
, responseType: 'code'
, params: {
scope: 'openid name email picture'
}
}});
lock.show();
</script>
I am not very familiar with node and js, but is there any way for implementing Auth0 login window not on a different page ( login.html
in my case) but in a popup modal window which can be accesed on any page? 我对node和js不太熟悉,但是有没有办法在不在其他页面(在我的情况下为
login.html
)但可以在任何页面访问的弹出模式窗口中实现Auth0登录窗口?
Yes, I do something similar where I call the login from a button in my navigation bar. 是的,我做了类似的事情,从导航栏中的按钮调用登录名。 Looks something like this:
看起来像这样:
<a class="button" onclick="lock.show();">Login</a>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.