forked from rDrama/rDrama
1
0
Fork 0

remove code that wasnt working

master
Aevann 2023-08-31 12:16:10 +03:00
parent 9872aee7b9
commit 7848587136
1 changed files with 2 additions and 7 deletions

View File

@ -31,13 +31,8 @@ def authorize(v):
return {"oauth_error": "Invalid `client_id`"}, 400
access_token = secrets.token_urlsafe(128)[:128]
try:
new_auth = ClientAuth(oauth_client = application.id, user_id = v.id, access_token=access_token)
g.db.add(new_auth)
except sqlalchemy.exc.IntegrityError:
g.db.rollback()
old_auth = g.db.query(ClientAuth).filter_by(oauth_client = application.id, user_id = v.id).one()
access_token = old_auth.access_token
new_auth = ClientAuth(oauth_client = application.id, user_id = v.id, access_token=access_token)
g.db.add(new_auth)
return redirect(f"{application.redirect_uri}?token={access_token}")