Loopback mysql and facebook login understanding - mysql

I new to loop-back platform. I follow this tutorial loop-back official tutorial for third-party and this tutorial also a tutorial that i find.
What i want to do is to build a rest API using loop-back as one project and a client side using angular as another project then to wrap it for mobile. In this tutorials they are using loop-back passport for make the oath connection with Facebook.
now my questions are :
They save all the models involved in the authentication in the memory and not in the database. is it good approach? don't i need to save all the access-tokens, identities and credentials on the database ?
is there another tutorial that you can direct me to or you can explain me , where in loop-back i get the information return from Facebook after authentication because i want to save it in my user model ?
Thanks

1.) It's not recommended to save authentication-data in memory in production, you can easily change this in server/model-config.json (or model-config.production.json) with the variable "dataSource" for each model. So instead of "memory" change it to the name of your datasource.
2.) In the example you provided, the "customProfileToUser"-function seems like an excellent place to save eventual extra data to your own User-model.

Related

Does code within NextJS API feature exposed to client side

It is well known that nextjs API routes provide a straightforward solution to build your API with Next.js. and that any file inside the folder pages/api is mapped to /api/* and will be treated as an API endpoint instead of a page.
I have just one doubt: is the code within the pages/api exposed to the world? I mean, can I build some logic there that has some key that must be hidden or maybe some MySQL connection?
Whether or not /api is in any way exposed to the world I do not know for sure, but according to Next documentation, "they are server-side only bundles."
In general though, for any key/sql connection that you want to run, I would put that into an .env.local file on your machine, a file that gets git ignored and never uploaded, and if you are hosting on Vercel, then use their environmental variables to store sensitive information.
You'd find environmental variables under:
{Your Account}/{Project}/Settings/Environmental Variables
p.s. Also from Next.js docs, I think you'd find this bit on getStaticProps useful.

Strategy for converting JSON to DBM Hash File (AEM with Apache backend)

I'm looking for some solution design assistance, as an idea I thought I could mimic apache's httxt2dbm tool.
Use case:
We currently manage our 301 RewriteRule's in apache for our AEM environment. My co-worker has built a webform for end users to submit their redirect requests and this puts the form data in MongoDB.
Problem:
How can I convert JSON into a dbm hash file like the httxt2bdm tool does?
Any ideas for how to tackle this problem?
The end goal here is that users can fill in the webform, then a cronjob will run and update apache followed by restarting httpd.
I know about the map manager tool but it doesn't really fit the use case.

How to get change in HTML DOM in LabVIEW?

I am doing IOT related project in Labview using Arudino as hardware.
I was able switch off/on an led on Arudino by Pressing OFF/ON on website by using datasocket vi. Now what i want is to control the intensity of led from Website.
I have a range slider in my website and its real time value can be viewed in textarea,div,input type.
Is there any way i can get that real time value that is being changed in HTML DOM in Labview.
I know that datasocket vi returns the html source code but not the HTML DOM.
I dont want to use the Web Publishing Services as they dont work in my Laptop.
This is the link im referring for datasocket.
Datasocket Labview
You can do something like creating a web socket, but I expect the easiest thing is to use a web service. You can create one in LV and add a setLEDIntensity method to it and call it from your JS code. You can find a simple example here and in other documents in that community.
Use WebSocket API for LabVIEW to send and receive data from the web. This is the best option for you.
https://decibel.ni.com/content/docs/DOC-40572

Send file from one user to another using using node.js and html5

I was creating a chat app using node.js, all things i m able to do but not able to get proper method to send files.
I need to send file from one user to other and wants to create skype like experience using node.js and html5.
please help.
Many Thanks in advance.
You could use sockets.io to push the file location to the user, or update a db when someone 'sends' a file, and the person that should get it uses a timed ajax post to query the db to see if they have a file to download.
I don't know if I'd trust users enough to allow them to send any kind of files over my server though. I also don't know if sockets.io can stream bytes from one user to another in order to avoid having to store the file on the server.

How do I make a file download require a username and password

In a basic HTML web page, how do you make the user have to enter a username and password before they are allowed to download a file?
What is the best way of achieving this on a website, preferably in plain HTML?
This can't be achieved in HTML.
With client side technologies, the best you are likely to be able to achieve is a JavaScript prompt that you use the data from to direct people to a secret URI.
This is something that really should be handled by the web server.
You won't be able to do this with plain HTML. Easiest way is probably to place the protected file in a directory protected by an .htaccess and .htpasswd file.
I agree with David...this can't really be done. Putting up a JavaScript prompt only protects you so far as well...that isn't really secure.
If you are on an Apache server, you could setup a .htaccess file and setup some user authorization options that point at a page which has the link to your download file. A simple implementation would give you 1 user/password combo that you could distribute to your users. The Apache documentation for this may be found here. Unfortunately I'm not really familiar with how IIS handles this sort of thing.
If you don't want to distribute a generic username/password combo to your users, you're pretty much going to be stuck creating a (or making use of an exsitng) user-management system. There are quite a few modules strewn throughout the web, and a simple Google search should bring you to quite a number of tutorials or existing implementations, depending on what you require.
first download phpmyadmin.open the file.click on create login.name it as login.php.then create a new want again name file.php.after you click yes it popout a logon information.enter the usrname you want and password you want
hope this help!