Is there any way to use facebook login on a localhost? - mysql

I am new to web development, I've learned php, mysql and javascript. I'm trying to make a website that uses facebook authentication and login. At the moment, I'm still working on localhost and am running xxamp. Is there any way to use the facebook development tools on a localhost? Or would it be simpler if I made my own mysql user database?
Thanks

Facebook authentication working same way in local environment as it working in every other place (just configure application using local URL's for "Canvas URL" and/or "Site URL"). To achieve this you may use both PHP-SDK and JS-SDK for that. See examples for PHP-SDK how-to implement authentication of user.
There is however functionality like social channels for which you'll need that Facebook be able to reach the machine your app running on (this may be solved with a bit of effort too)...

Related

How to get file contents of old site on drupal?

We have a site running to drupal and migrated it to Squarespace. I have to retrieve some pages of drupal site but I can no longer view the site. Do you know any way to get the old content of website on drupal? Please know that we still have access to the drupal box. Any suggestions will be a big help.
Easiest way would be to make the old Drupal site available again through the browser running on a different domain like old.example.com, login into the admin panel and start copy/pasting content.
If you know your way around your computer, know the IP address the old server is running on you could for the time being change the host file of your machine to send requests for your site to the old server and get access to the site that way.
Migrating content by automating the process is also an option, but it is not only time consuming, it requires in depth knowledge of both platforms so is mostly a very expensive solution if you are not able to do this yourself.
But if I read your question, I think the first option is the easiest option. Get a hold of the technical person/party of the server the site is running on and get them to make the site accessible on a different domain.

How do I link a react app I am building using webpack to a phpmyadmin external database and query it without showing my database password in the code?

So I am currently learning react and webpack so that I can implement it into my current site. I already have an established phpmyadmin database that pumps out information that I want to appear on my site but I cant figure out how to hide my username and password to the database when programming it. I am used to using php to interact with my database bus since react is purely javascript I am not sure what to do.
You need to have a server running that talks to your database and to your react app. It sounds like you might have this in the form of a PHP application. Your PHP application will need to expose data over HTTP endpoints that you can then fetch from inside of your React application.
This tutorial: https://www.techiediaries.com/php-react-rest-api-crud-tutorial/ would be a great place for you to get started.
I agree that you need to "have a server running that talks to your database and to your react app" as the accepted answer states. On the other hand this does not mean that you have to code it from scratch.
If you don't want to program PHP for the back-end, then you may as well configure software from the list of 'automatic APIs'. An automatic API is "software that turns your database into a REST/GraphQL API".
I'm the author of PHP-CRUD-API, which is an 'automatic API' and I think it suits your needs, but you may as well use any other software from the above list.

How to password protect website hosted on Amazon Web Services (AWS)

I wanted to create a website that would be like a dropbox of sort, which just has files that me and my organization can access. I wanted to password protect the website, just a simple username and password. I have my own domain. I have been looking all over the web to find how to do this(I am a beginner) and found that using httaccess and htpasswd would be used to secure a website similar to what is shown here: http://www.htaccesstools.com/articles/password-protection/
But I cannot seem to get it to work. I am using the s3 bucket and putting the httaccess and htpasswd file in the same folder as the index.html file. Do you know how I would get my site to have a simple password protection(thats not seen in the source code or by typing in the html)? I am not sure if I am finding the directory correctly or not to implement this password protection correctly. Thank you for taking the time to read this and hopefully this makes sense!
Anyone else had this issue?
Amazon AWS alone won't do it. htaccess and htpasswd are also not the right tools for what you want to do.
Get yourself a cheap hosting account with a company like hostgator or godaddy or namecheap or any other that will host your web page and give you PHP and MySQL.
You cannot accomplish what you want just using javascript/jQuery. Those languages run on the browser, but you want to store your files on a server. Therefore, you need the language that controls the server - that is usually PHP. (The other popular solution is ASP, which is by Microsoft and runs on costly and complex Microsoft servers -- PHP is free and runs on (free) Linux and is therefore what ALL of the cheap web hosting companies provide. MySQL is the (free) database that is analogous to Microsoft SQL)
Next, watch a video tutorial on creating a PHP / MySQL login system, such as the ones over at:
phpAcademy (now called codecourse, apparently)
theNewBoston.com
You need to learn more about:
PHP sessions
Ajax
jQuery
MySQL (possibly)
On a basic website, you can stick your files into directories and control who can access those directories by whether or not they are logged in.
You can determine if a visitor is "logged-in" or not by asking for a username/password and setting a session variable. Session variables are just variables that are stored on the server, rather than on a user's own computer (of course, that wouldn't work since every visitor has his own computer and your files are stored on a central server -- so that is where the security (variables) must reside, right?)
Anyway, in a weekend of video watching and trial-and-error you can probably get something cobbled together that will do what you want.

AngularJs real time app with mysql server

Is it possible to build a realtime app using AngularJs with a mysql database?
I've been reading thousands of tutorials, but they are all focused on express, nodejs, etc.. didn't found any documentation on wheter it's possible or not. I tried to take a look at the socket.io docs, but still didn't found anything relevant to this question.
I didn't tried anything yet because of this. I use a webApp based on AngularJs on a apache server (local).
Where should i start to be able to build a real time app using these tools i have?
Do i really need to use a node/express server?
What are the main consideration i need to do before taking this step?
Is there any documentation i should read?
I need to do this real time because it involves product orders, call center, ticket system, etc.. So everytime there is a new ticket is opened/changed, new order arrives, etc.. I need to make the user aware of this, without the need to refresh the page.
Or if someone could give me a further explanation of this concept and how to get started, it will be great.
You can run angular on top of any backend, although most examples push towards REST. If you want your app to feel like a real time application, using WebSockets is a likely improvement.
WebSockets play nice with Angular, look at https://github.com/wilk/ng-websocket for example. A back-end in Node will work, but many other backend techs will do equally well.
Here is a decent tutorial using MySQL, NodeJS, and Angular: https://codeforgeek.com/2015/03/real-time-app-socket-io/
I recommend that you keep using a webserver like Apache (my personal preference is Nginx). You can proxy API and socket requests to Node, and serve static resources for the app from a folder.
Check out https://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html if you stay with Apache. Check out http://nginx.org/en/docs/http/websocket.html is you go for nginx.
Without a webserver, you'll have to either:
serve your static resources with Node (polluting your server project with client code), or
work with different ports, risking the app becomes unusable in client environments, or
work with different domains, giving you a CORS head-ache.
Although I don't have much experience with Node, MySQL with Node.js should help you out a bit.
You'll want to move away from Apache if you want to do websocket stuff with Socket.io
Yes, it is possible to create a software with AngularJS in the front end and any other server side language that speaks to MySQL. Few months back I worked on a software with Java Spring Framework in the backend with MySQL database and AngularJS with bootstrap in the front end. You could start by following the MVC pattern, where your views can be served as AngularJS and your Controller can be in any server side code, with MySQL database.

Configuring authentication and authorization in Apache2 with MySQL

I am trying to configure Apache2 so I can use MySQL for authenticating users to access certain pages. Also authorization needs to work so different groups can reach differen pages.
Now, I have googled a lot but can't find out how to do this. At least not for the configuration I am having. There doesn't seem to be any version of mod_auth_mysql that supports my configuration.
OSX 10.6.4
Apache 2.2
Now, how do I achieve this not creating my own login-application in php but using the built in support of Apache2? I'm totally stuck on this one...
Thanks in advance!
Regards,
Niklas
I also would like to use a taylormade login page, not pop-up
....
how do I achieve this not creating my own login-application in php but using the built in support of Apache2
Short answer is that you can't. Unless you rewrite the Apache source code or create your own module, you can't mix HTTP based authentication with non-pop-up login prompts.
However if you are using PHP then a relatively low impact solution would be to use auto-prepend to prefix every protected page with a check on the users session. Obviously this would need a bit more thought if it is to be applied to files other than PHP source files (it'll work perfectly well if you tell Apache to apply the php engine to, say .gif files, but your script will need to detect and return the appropriate mime type).
A simpler solution might be to put a tool like squid in front of the webserver as a reverse proxy, then make the session handling data available to the squid url-rewriter.
You can build mod_auth_mysql from the source. Have a look at this post.
I you want your own log-in page, you cannot use Apache to do authentication.
Apache authentication uses the Authentication portion of the HTTP standard, and as a result you're reliant on the browser to handle the interaction with the user. There are plugins (like mod_auth_mysql) to use a database as the backend for this, but Apache can't ask the user for their credentials any other way.
The fastest approach might well be to set up Drupal or Joomla, which will get you user and group management as well as full content editing, in a way that will let you control who can edit what.