I’ve been asked to create a stand-alone webapp using “straight” HTML and Javascript that does user authentication against an existing PHP app (backend is MySQL). Unfortunately, I really don’t have a firm grasp on how PHP authentication works, and I’d rather not invest a lot of time in learning PHP just for this particular case.
I can see two possibilites so far
1) create a PHP wrapper around my new app and use native PHP authentication (don’t like this)
2) create a simple REST-ful webservice around the PHP authentication (don’t know how to do this)
Anything else I should consider? Help is much appreciated!
There is no one standard way of doing php authentication. Typically it involves storing some information or UID in sessions, but it’s difficult to generalize.
You need to find out how the existing authentication works by looking at what forms are submitting where.
For example, if you find that the login form is something like
You can emulate a form submission using an AJAX call.
Such a call might look something like this in JQuery: