Giter VIP home page Giter VIP logo

Comments (2)

mattupstate avatar mattupstate commented on September 26, 2024

This could be tricky. I'm wondering if there is support in the API clients to know if an access token has expired and we can, within Flask-Social, handle that somehow, get a new token, and store the new token in the database.

I'm also not sure how you would "logout a user without an app context". Most database extensions (such as Flask-SQLAlchemy) require an app context to access the database. If you have a background/async task, it should be run within an app context.

For instance, here's an example of how to make Celery create an app context before running each task.

from flask-social.

eriktaubeneck avatar eriktaubeneck commented on September 26, 2024

With the Facebook API, you receive an error on any request you make. Repeating the login flow should update it, however the way Flask-Social is written, we don't override the connection object when we do a login. We could add an attribute to the connection like "needs_refresh", check for that on the login, and change the flow if it's True. (and you could set the attribute to True any time you run into the error by using the old token.)

Thanks for the example for the context. I usually just import the db object from my __init__.py file, which must carry along a context with it. This will be useful.

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.