Simple scenario, let's say a user has two email addresses:
[email protected]
[email protected]
I want to authenticate both email addresses. All of the examples in the docs involve storing one oauth token per user account, e.g.:
class CredentialsModel(models.Model):
id = models.ForeignKey(User, primary_key=True)
credential = CredentialsField()
So if a single user account on my website has multiple associated email addresses, do I still store one oauth2 credential for that user? Or do I need to use the email address as the primary key instead of using the user id as a foreign key? Right now I'm storing a different credential for each email address, although when I look in the database the credential looks the same for both of my email addresses. I'm not sure if I'm just doing something wrong or what.
Secondly, I realize this is a basic question, but when a user authorizes an email address, how do I know which email address they have authorized? I'm using the google-api-python-client to do all the validation, but I don't see anything in the python docs about how to do this.
ForeignKey
, so there can be manyCredentialsModel
instances perUser
. On the other hand the application code has to support that as well. – Klaus D.