简体   繁体   中英

Laravel authentication for Node.js app

So this is the scenario. I have very simple Laravel app with basic authentication set up. I also have node application running on port 3000. I am using nginx for a web server. I have proxy setup so I can access node app via https://test.dev/nodeapp

My question is: Is it possible to have laravel running on https://test.dev and restrict access to my node app with Laravel authentication (middleware).

All I want is to let users use node app after successful authentication through Laravel.

I have no idea how to handle that (no idea if something like that is even possible). As far as my understanding goes node application is not a part of framework and I can't specify the route withing needed middleware.

Is there anything that could be done on the server side?

Could anyone shade some light on the subject? Thank in advance.

I will try to elaborate a little bit what i want to achieve.

Laravel may be not the best option here. This just for personal portfolio purposes. I need restrict access to the page where all my portfolio examples will be placed. I have a lot of server side examples. I want to give visitor ability to run ssh through the browser so they can run scripts directly on the server.

For a web terminal I am using Wetty which runs on node. So far works great. There is of course ssh authentication and all is running over HTTPS.

The way to start wetty is to run "node app.js -p 3000", I don't know if I can integrate it with express...

The thing is this is not a publicly available application, and everything runs on demo instance of the ubuntu server. Still I am a little bit concern about security. I was hoping I could have authentication in place before user can even invoke ssh client.

Looks like it will be better to handle everything on node without php involvement which is not necessary for such a simple use case.

If anyone else have some suggestion I will appreciate it.

Sorry but is not the right way bro there is a simple method is to use a API . make your authentication in Laravel returns JSON the view for your auth (Login form) will be in your Node app ( try ExpressJS to manage routes and views ) after click on Login button you call your Laravel api check the retuned json then open session using Session

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM