I have a login page that accesses node.js which in turn shud access another server to provide authentication to my login page!how to i achieve dat? pls do help i am entirely new to node.js
You can use http.request
http://nodejs.org/api/http.html#http_http_request_options_callback
Related
I am using Angular 5 with Firebase, i understand the firebase credential in Angular has the chance to leak to client side when rendering the pages. But Firebase Products can use rules to secure it, i found it doesn't harm any to me.
But i have another question, what if I want to use SQL or any other services that require credential to perform authentication before executing an action, such as read/write from a SQL table.
When I using Node.js, the credential will declare in the server-side JS file, but apparently Angular is client-side framework. So i would like to know to solve this problem.
Thank you!
Code on your server/node app won't be available to the frontend.
Only data that's requested by the client via http requests is available to the Angular app.
So as long you don't return the critical data through your api you're good to go.
I am new to NodeJs and what to create a login page by Node JS and afterwards I want to authentication for login with the same.
Kindly let me know what all I should know to do a basic nodejs login page and how should I proceed?
Thanks
this example made using express which is small framework for node.js
Easy Node Authentication
I recently bought a new template for my site written in angular2, i did a short course on it and started to work and everything fine.
Now come the the part where i try to connect it to my DataBase and i cant figure it out...
after a little bit of reading i saw that i need to use nodejs in order to speak with the server side, is that true?
can i use php or i must use the nodejs api to work with my Db?
am i missing the concept of the angular2 or something? can someone post a basic script of angular working with php example , i just cant find it.. :(
thanks a lot :)
The most common scenario is that you use the Http service in Angular that makes XHR (Ajax) requests to the server to fetch data (not HTML).
You can use any server that is able to receive, process and response to XHR requests. Therefore PHP is as suiteable as node.js (or .NET, Java, or any other web server)
See also https://angular.io/docs/ts/latest/guide/server-communication.html
I am using the Facebook SDK on a mobile app. After the login, I get a token (long string) from facebook. I want to use this to connect to a remove mongodb database and update or query the database there.
Am I correct in understanding that:
I need to run node.js on the remote server and then
make a connection from the app to the remote node.js, and then
have node.js query the mongodb
If yes, can someone please point me to a simple example that demonstrates this?
thanks!
What you require is API(mostly REST which understands JSON), much like the Facebook api your mobile app is already talking to. Your mobile app will also communicate with this API, which in turn connects to MongoDB and preforms desired operation.
Look here to get basic understanding of REST API
Look here for sample REST API implementation using nodejs.
I found a solution which is in line with what I need: http://www.quietless.com/kitchen/building-a-login-system-in-node-js-and-mongodb/
I have developed a front-end interface using Aja(AngularJS) and HTML5. Right now, I send an HTTP get request to my backend server which returns some data based on the GET parameters.
Since the URL is exposed in the Javascript file, I believe anyone could just use the URL to create there own API to fetch the data. How can I prevent such things ?
One way I could think of is that now instead of directly sending the request to the backend server, an application server could be used (hosting the HTML as well). The Ajax request would then be sent to this server (PHP script ?) which would in turn forward the request to the backend server and return the result to the UI. To prevent 3rd party services, I can disable cross origin requests on my application server.
Is this the correct way to solve my problem or are there better ways to do this? I am concerned that this would unnecessarily create another hop (internal though) for requests.
Note: The backend is running Apache Tomcat
In APIs that are not open to the world the user has to authenticate first in order to use it, see for example https://stripe.com/docs/api#authentication or http://dev.maxmind.com/geoip/geoip2/web-services/ -> Authorization