• caglararli@hotmail.com
  • 05386281520

Using one server and user database for multiple websites

Çağlar Arlı      -    61 Views

Using one server and user database for multiple websites

Goal

I'd like to have multiple independent websites with one shared authentication server. The auth server will have one database in which all users are stored (just username, email and password, so different data models are of no concern). User 1 from website A should only be able to log-in at A.com, while user 2 from website B should only be able to log-in at B.com.

Question

Would it be SAFE to store the url of the website with the user record, which is the only website they should be granted access to? So for example:
{
   username: a,
   email: a@myspace.com
   password: ****
   website: A.com
}, 
{
   username: b,
   email: b@myspace.com
   password: ****
   website: B.com
}

Why this approach

Correct me if I'm wrong, but otherwise I'd have to host a seperate database, cache and server for each website with a log-in.