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
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