Skip to content

Commit

Permalink
feat: user login OAuth
Browse files Browse the repository at this point in the history
  • Loading branch information
Scobiform committed Apr 17, 2024
1 parent e0e0b9d commit 259a001
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions start.py
Original file line number Diff line number Diff line change
Expand Up @@ -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! <br>
<a href="/logout">Logout</a>'''+mastodon.me().username+'''
<a href="/logout">Logout</a><br>
Username: {user['username']}
<br>
'''
return '<a href="/login">Login with Mastodon</a>'
Expand Down

0 comments on commit 259a001

Please sign in to comment.