Giter VIP home page Giter VIP logo

Comments (11)

mattupstate avatar mattupstate commented on June 26, 2024

@tedmiston Have you checked your database to see if the proper fields were set? You may also want to set nullable=False on the user_id field of the Connection class and see if any issues arise when a user authorizes a connection with Facebook.

from flask-social.

tedmiston avatar tedmiston commented on June 26, 2024

@mattupstate In the connection table,

  • these fields are set: id, user_id, provider_id, access_token, display_name, profile_url, image_url
  • and these fields are null: secret, rank

In the user table:

  • set: id, email, password, active
  • null: confirmed_at

The initial authorization appears to be happening properly to make this database row and on Facebook to give the permissions, but the error occurs when I click the Login with Facebook button while not logged for a Facebook account that's already authorized.

(I've also tried clearing the app permissions on Facebook and following the same steps to ensure I can reproduce it.)

Edit: Also, I don't think it should matter, but I'm currently using SQLite behind SQLAlchemy.

from flask-social.

eriktaubeneck avatar eriktaubeneck commented on June 26, 2024

You'll want to create a SQLAlchemy Relationship to connect the Connection and the User. This will produce a Connection.user_id and automagically created a Connection.user reference that looks up the user from the user_id.

from flask-social.

mattupstate avatar mattupstate commented on June 26, 2024

Oh right, do you have user = db.relationship('User') on the Connection class? Is that missing from the docs?

from flask-social.

eriktaubeneck avatar eriktaubeneck commented on June 26, 2024

Just looked. It has user_id = db.Column(db.Integer, db.ForeignKey('user.id')) on the Connection. We should update that.

from flask-social.

eriktaubeneck avatar eriktaubeneck commented on June 26, 2024

I can do that, I'll ping you @mattupstate when it's up so you can refresh the pythonhosted.org page.

from flask-social.

tedmiston avatar tedmiston commented on June 26, 2024

@mattupstate So I do not have that on the connection class (and it is not in the docs at https://pythonhosted.org/Flask-Social/).

I took a minute to download the old flask-social-example, and saw this line that wasn't in the docs:

class User(db.Model, UserMixin):
    ...
    connections = db.relationship('Connection',
            backref=db.backref('user', lazy='joined'), cascade="all")

Adding this appears to fix the error on my end. Is this equivalent to what you suggested?

from flask-social.

eriktaubeneck avatar eriktaubeneck commented on June 26, 2024

Yep, that will work as well.

from flask-social.

eriktaubeneck avatar eriktaubeneck commented on June 26, 2024

@mattupstate updated on master and merged into develop.

from flask-social.

tedmiston avatar tedmiston commented on June 26, 2024

Awesome. Thanks for the quick responses!

Edit: I guess shouldn't close this so abruptly in case you guys would like to add any additional comments.

from flask-social.

amostsai avatar amostsai commented on June 26, 2024

it's work. thanks a lot

from flask-social.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.