-
Hi, (register) @app.route("/auth/discord/callback/")
def route_auth_discord_callback():
discord.callback()
user = discord.fetch_user()
if not user_datastore.find_user(email=user.email):
characters = string.ascii_letters + string.digits + string.punctuation
password = ''.join(random.choice(characters) for i in range(32))
user_datastore.create_user(username=user.name,email=user.email,password=password)
db.session.commit()``` |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I am not familiar with Flask-Discord - however here are some ideas. First - as you have done - you need to create/register the user in the Flask-Security DB. |
Beta Was this translation helpful? Give feedback.
I am not familiar with Flask-Discord - however here are some ideas. First - as you have done - you need to create/register the user in the Flask-Security DB.
Second - once your client has successfully authenticated with Discord - in your callback/view you need to 'login' the user - this will set up the session cookie for all future calls. Do this by calling flask_security.login_user(user)