title: Flask-OAuth database structure for password and username columns
body: <p>I am trying to implement user registration and login system on Flask, which will accept traditional email registration along with OAuth 2.0 (Google and Facebook) registration and login.<br>
  For registration using email, its clear for me: I am collecting data using forms and writting into respective table.</p>
  <pre><code>user = Account(email=form.email.data.lower(), username=form.username.data.lower(), password=form.password.data) 
  </code></pre>
  <p>In order to login into the system I ask for username and respective password.
  When it comes to OAuth Google login, after requesting the service and receiving the response from Google, I need to write received data into the table. For that purpose I have added extra column OAuth_ID, where I store user id received from Google.</p>
  <pre><code>if userinfo_response.json().get(&quot;email_verified&quot;):
          unique_id = userinfo_response.json()[&quot;sub&quot;]
          users_email = userinfo_response.json()[&quot;email&quot;]
          picture = userinfo_response.json()[&quot;picture&quot;]
          users_name = userinfo_response.json()[&quot;given_name&quot;]
      else:
          return &quot;User email not available or not verified by Google.&quot;, 400
      user = Account.query.filter_by(email=users_email).first()
      if user is None:
          user = Account(email=users_email.lower(), oauth_id=unique_id, username=users_name.lower(), password='test-password')
          db.session.add(user)
          db.session.commit()
  </code></pre>
  <p>Please advice regarding the following:
  What shall I do with password field, which is mandatory (nullable=False) in database and required when registering using email. Above, I have inserted password manually for testing purpose which is wrong approach.</p>
  <pre><code>user = Account(email=users_email.lower(), oauth_id=unique_id, username=users_name.lower(), password='test-password')
  </code></pre>
  <p>How can I deal with passwords when I use OAuth?
  Second: What shall I do with username? Through Google OAuth I cant receive it.</p>
  <p>Database model:</p>
  <pre><code>class Account(UserMixin, db.Model):
      __tablename__ = 'accounts'
      id = db.Column(db.Integer, primary_key=True)
      username = db.Column(db.String(30), nullable=False, unique=True, index=True)
      password_hash = db.Column(db.String(128), nullable=False)
      email = db.Column(db.String(50), nullable=False, unique=True)
      activated = db.Column(db.Boolean, nullable=False, default=False)
      activated_on = db.Column(db.Date)
      last_seen = db.Column(db.DateTime(), default=datetime.utcnow)
      oauth_id=db.Column(db.Integer(), unique=True, index=True)
      role_id = db.Column(db.Integer(), db.ForeignKey('roles.id'))
      user_login = db.relationship(&quot;User&quot;, uselist=False, backref=&quot;accounts&quot;)
  
  class User(db.Model):
      __tablename__ = 'users'
      id = db.Column(db.Integer, primary_key=True)
      first_name = db.Column(db.String(50, collation='NOCASE'), nullable=False)
      last_name = db.Column(db.String(50, collation='NOCASE'), nullable=False)
      phone = db.Column(db.String(15), nullable=False)
      login_id = db.Column(db.Integer, db.ForeignKey('accounts.id'))
  </code></pre>
  <p>Thank you in advance!</p>