Flask-Dance cannot add entries more than 1. This also causes people to login into others accounts. This is how the db looks like all the time:
We are using sqlalchemy to cache user logins.
dbsl = SQLAlchemy()
d_oauth = discord_oauth.make_discord_blueprint(
client_id="id",
client_secret="secret",
scope=["guilds", "identify"],
redirect_to="index",
login_url="/",
authorized_url="/authorized"
)
class OAuth(OAuthConsumerMixin, dbsl.Model):
pass
d_oauth.storage = SQLAlchemyStorage(OAuth, dbsl.session)
dbsl.create_all()
This is our Flask app:
def create_app():
app_db = Flask(__name__)
app_db.config["SECRET_KEY"] = "please-work"
app_db.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///configs/cache.sqlite3"
app_db.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app_db.config["SESSION_TYPE"] = "sqlalchemy"
app_db.config["SESSION_SQLALCHEMY_TABLE"] = "flask_dance_oauth"
app_db.config.from_object(__name__)
#sess = Session(app_db)
#sess.init_app(app_db)
dbsl.init_app(app_db)
app_db.app_context().push()
return app_db
We really don't know how to fix this, can anyone help?