Lock not working with nwjs (former node-webkit) version 0.12.3
Auth0-Lock cannot be used with nwjs anymore. You can load version 7.1.5 but then it is not able to connect to the server.
With version 7.3 and 7.4 i am getting the screen but after login i get the error : invalid origin file:// I have already added file://* to valid origins.
Any version above results in an error 'Auth0-Lock' not loaded.
Here is the code for calling the lock
<script src="https://cdn.auth0.com/js/lock-7.4.js"></script>
<script type="text/javascript">
var lock = new Auth0Lock('***, '***.eu.auth0.com');
lock.show(function(err, profile, id_token) {
if (err) {
console.log("There was an error :/", err);
return;
}
console.log("Hey dude", profile);
})
</script>
@Silve2611 We ensure browser compatibility in Chrome, Safari, Firefox and IE >= 9. Can you provide a minimal example project with the issue you describe?
Hi,
I created a public repositroy: https://bitbucket.org/timeBroMislav/authsample.git https://bitbucket.org/timeBroMislav/authsample.git
In the index.html which is inside the nwjs.app/Contents/Ressources/app.nw the client id and the auth domain have to be added. Let me know if something is unclear.
I think supporting nwjs (aka node-webkit) will be very interesting for auth0. A lot of people are using it as it is plattform independet and it is therefore quite easy to publish. We want to write an application and would be happy to work with auth0
Best, Mislav Boras
Am 24.11.2015 um 20:29 schrieb Gabriel Andretta [email protected]:
@Silve2611 https://github.com/Silve2611 We ensure browser compatibility in Chrome, Safari, Firefox and IE >= 9. Can you provide a minimal example project with the issue you describe?
— Reply to this email directly or view it on GitHub https://github.com/auth0/lock/issues/260#issuecomment-159380816.
@Silve2611 Thanks! When running the example I see a "not allowed to load local resource" error in the console when the redirect to the file:// url is made. This is a NW.js protection.
You can avoid the redirect by passing a callback to show:
lock.show({
// options...
}, function onLogin(err, profile, id_token) {
if (!err) {
// User is logged in, you can perform the redirect here if you really need to
}
});
Hi,
Thank you for your help. But actually the login ist not working in the first place. If i open the app on the first time i click on login and it redirects me somewhere. It is opening a popup that is redirecting me to https://timebro.eu.auth0.com/login?client=3UNDSdp3oZFMZncNib1QBxmLFZ9t2gVx&protocol=oauth2&scope=openid&response_type=token&connection=Username-Password-Authentication&sso=true&login_hint=&owp=true https://timebro.eu.auth0.com/login?client=3UNDSdp3oZFMZncNib1QBxmLFZ9t2gVx&protocol=oauth2&scope=openid&response_type=token&connection=Username-Password-Authentication&sso=true&login_hint=&owp=true
I didn’t even specifiy the option of popup. I just want to login to my side and receive an token. What is wrong?
Best, Mislav
Am 24.11.2015 um 22:22 schrieb Gabriel Andretta [email protected]:
@Silve2611 https://github.com/Silve2611 Thanks! When running the example I see a "not allowed to load local resource" error in the console when the redirect to the file:// url is made. This is a NW.js protection.
You can avoid the redirect by passing a callback to show:
lock.show({ // options... }, function onLogin(err, profile, id_token) { if (!err) { // User is logged in, you can perform the redirect here if you really need to } }); — Reply to this email directly or view it on GitHub https://github.com/auth0/lock/issues/260#issuecomment-159408574.
Hi,
I now understand what you did there it is working for a simple login. The problem is if i reload the app i am getting the following screen.
If i click on the login the it opens a popup redirecting me to https://timebro.eu.auth0.com/login?client=3UNDSdp3oZFMZncNib1QBxmLFZ9t2gVx&protocol=oauth2&scope=openid&response_type=token&connection=Username-Password-Authentication&sso=true&login_hint=&owp=true https://timebro.eu.auth0.com/login?client=3UNDSdp3oZFMZncNib1QBxmLFZ9t2gVx&protocol=oauth2&scope=openid&response_type=token&connection=Username-Password-Authentication&sso=true&login_hint=&owp=true
Best, Mislav Boras
Am 24.11.2015 um 22:22 schrieb Gabriel Andretta [email protected]:
@Silve2611 https://github.com/Silve2611 Thanks! When running the example I see a "not allowed to load local resource" error in the console when the redirect to the file:// url is made. This is a NW.js protection.
You can avoid the redirect by passing a callback to show:
lock.show({ // options... }, function onLogin(err, profile, id_token) { if (!err) { // User is logged in, you can perform the redirect here if you really need to } }); — Reply to this email directly or view it on GitHub https://github.com/auth0/lock/issues/260#issuecomment-159408574.
Hi,
I have come a step closer. I have set 'rememberLastLogin: false,‘ I would save the token in a database and perform the check if its still valid myself before calling the lock. But I am running into another error now.
What can be the reason for that?
Best, Mislav Boras
Am 24.11.2015 um 22:22 schrieb Gabriel Andretta [email protected]:
@Silve2611 https://github.com/Silve2611 Thanks! When running the example I see a "not allowed to load local resource" error in the console when the redirect to the file:// url is made. This is a NW.js protection.
You can avoid the redirect by passing a callback to show:
lock.show({ // options... }, function onLogin(err, profile, id_token) { if (!err) { // User is logged in, you can perform the redirect here if you really need to } }); — Reply to this email directly or view it on GitHub https://github.com/auth0/lock/issues/260#issuecomment-159408574.
@Silve2611 the redirect is happening in the popup? can you share the new code you are using to open the Lock?
Hi,
I added an update on https://bitbucket.org/timeBroMislav/authsample.git https://bitbucket.org/timeBroMislav/authsample.git
Best, Mislav
Am 25.11.2015 um 21:20 schrieb Gabriel Andretta [email protected]:
@Silve2611 https://github.com/Silve2611 the redirect is happening in the popup? can you share the new code you are using to open the Lock?
— Reply to this email directly or view it on GitHub https://github.com/auth0/lock/issues/260#issuecomment-159721669.
There is also another problem. The JS for lock causes the following error
Which makes debugging for an app very hard.
Best, Mislav
Am 25.11.2015 um 21:20 schrieb Gabriel Andretta [email protected]:
@Silve2611 https://github.com/Silve2611 the redirect is happening in the popup? can you share the new code you are using to open the Lock?
— Reply to this email directly or view it on GitHub https://github.com/auth0/lock/issues/260#issuecomment-159721669.
@Silve2611 Hi, we don’t have the bandwidth to investigate this right now, but we will definitively take care of it (we are currently working on a new version of Lock).
In the meantime, have you considered building your own widget with auth0.js ?
Hi,
I know it takes some time to easy out all errors. You are already doing great work. I will consider your idea of building my own widget. Another solution would be to use our Authentication API. Thank you for your support! I will keep trying.
Best, Mislav
Am 26.11.2015 um 22:03 schrieb Gabriel Andretta [email protected]:
@Silve2611 https://github.com/Silve2611 Hi, we don’t have the bandwidth to investigate this right now, but we will definitively take care of it (we are currently working on a new version of Lock).
In the meantime, have you considered building your own widget with auth0.js https://github.com/auth0/auth0.js ?
— Reply to this email directly or view it on GitHub https://github.com/auth0/lock/issues/260#issuecomment-159993846.
@Silve2611 Did you solved this? I also have a same issue. cannot display auth0 login window in nwjs. while works fine in Chrome browser.
@EricCat I could not use the lock.js so i wrote my own. It is basically a modal window that pops up and cannot be closed unless you login. The Login is a Rest-Call to the server.
@Silve2611 Thanks a lot!
After look into lock.js (7.x), I found must using global.Auth0Lock(client, domain); but this not working on 8.x, due to nwjs cannot handle document to window.document somehow. but it works on 7.x
Closing this one, please reopen if it's still an issue with latest lock version