From 259a001c95f2badd1cf3c7916d7ebf0eab217fb8 Mon Sep 17 00:00:00 2001 From: Scobiform Date: Wed, 17 Apr 2024 15:22:38 +0200 Subject: [PATCH] feat: user login OAuth --- start.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/start.py b/start.py index 6c2e91d..b2c3d84 100644 --- a/start.py +++ b/start.py @@ -42,9 +42,16 @@ async def setup_app(): @app.route('/') async def home(): if 'access_token' in session: - return ''' + # Initialize Mastodon with the access token + mastodon = Mastodon( + access_token=session['access_token'], + api_base_url=config['instance_url'] + ) + user = await mastodon.account_verify_credentials() + return f''' Logged in successfully!
- Logout'''+mastodon.me().username+''' + Logout
+ Username: {user['username']}
''' return 'Login with Mastodon'