mastodon / mastodon/documentation
Mastodon OAuth Login Bug With 2FA
Nobody has claimed this yet.
- Dominant language
- SCSS
- Stars
- 1.7k
- Forks
- 978
- PR merge metrics
- No merged PRs in 30d
Description
Hello.
I am developing a small PHP application that allows users to log in with Mastodon using OAuth.
The login flow works normally for accounts without two factor authentication:
- User clicks login
- Mastodon authorization page opens
- User approves the application
- User is redirected to my callback.php
- Login completes successfully
However when a user has 2FA enabled on their Mastodon account, the behavior changes.
The flow becomes:
- User approves the application
- Mastodon asks for the 2FA code
- User enters the code
- After successful verification the user is not redirected to my callback URL
Because of this the OAuth login process never finishes.
My question is:
Is there an additional step required in the OAuth flow when 2FA is enabled
or could this be a bug with the redirect after 2FA verification
Has anyone experienced this before?
Thank you.
auth_check.php
callback.php
login.php
mastodon_helpers.php
config.php
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the attached auth_check.php, login.php, callback.php, and mastodon_helpers.php files to trace the OAuth redirect handling. Reproduce the flow with and without Mastodon 2FA and determine whether the callback is reached after verification. Done means identifying whether an additional OAuth step or a redirect defect is responsible and documenting the result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100