Since the party name and password are already stored in your database, then you should just store the user association to a party as well.
So one way of many
- Store a table with all the party names, party ID and passwords
- Store a table with the users, user ID and access tokens
- Store a table that matches a party ID to a user ID
So then when you look up a user by access token
- you query for a the ID associated with that access token
- you do a query on your database to look up all PIDs (party ID) associated with that user ID
Of course based on your scale and the actual final schema you are looking at you will need to change this around.
Try to write out a flowchart to see how it will show. For example this is a flowchart showing two logins, email and Facebook.
2
solved Facebook login session with a second login