1

I want to wish to create an application that registers/takes the users details (username, email and password primarily) into a MySQL Database from the domain example.com; however I am having trouble to find out how this information can be used to login into that site on subdomain.example.com and anotherdomain.com.

1 Answer 1

1

I can't get exactly your question, but I guess what you're trying to do is, you have 2 websites, let's say Website1.com and Website2.com and you want the user to be authenticated in Website2.com using his/her credentials from Website1.com.

You don't need to take user's password from Website1.com just to grant access to Website2.com. Passwords are usually salted (MD5, SHA256, etc.) and are very near to impossible to be reversed. Which is why Website1.com should provide a web service API. Take for example, www.Facebook.com and www.StackOverflow.com as our Website1 and Website2 respectively. When you're trying to log in here using your Facebook account. It redirects you first to Facebook's login page wherein the authentication takes place in Facebook. After the authentication in Facebook, next is you're being redirected here in Stackoverflow.

Take Facebook API as the best example if you want to create your own authentication API: Manually build a login flow

Another related inquiry here might also give help: Using facebook login for my website

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for the answer, it clears my confusion. But are there any tutorials that explains on how to create or how Web API's work, thanks in advance.
Start studying on how to create RESTful API in PHP. Here's a good introduction youtube.com/watch?v=5eWC-lf1FxM. And here's a good example on how to add Token-based security to your RESTFul API: youtube.com/watch?v=3c9KDf5p_Vc. Youtube is such a great place to learn stuff ;)
Thanks once again for your reply!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.