nuxt-modules / nuxt-modules/supabase
Support MFA in auth-redirect plugin
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 935
- Forks
- 157
- Avg merge
- 7d 17h
- Merged PRs (30d)
- 1
Description
Is your feature request related to a problem? Please describe.
I'm in the progress of setting up an MFA process to my app.
Obviously after setup, the MFA should (for users that have it enabled) require MFA right after login.
In my understanding of nuxt, this should be done as part of a (global) middleware - checking if the MFA challange is missing and redirecting the user to that location.
While the supabase documentation for this is pretty straightforward for setup - i think the "challange step to login" step is not - at least not how it's best implemented / enforced in a nuxt application.
Describe the solution you'd like
An (optional) feature added to auth-redirect which automatically redirects the user to a /mfa-challange route (obiviously configurable) if MFA is required (essentially, for the aal1-> aal2 step).
In my understanding so far, there could be a check of the "factors" array of the user object to check if 2FA factors are set up - and if they are, an additional call to supabase.auth.mfa.getAuthenticatorAssuranceLevel() can be made - which will determine if a redirect to /mfa-challange will be necessary.
Describe alternatives you've considered
Implement my own middleware to handle the same thing.
While this will certainly work - it'll mean there will be 2 handlers performing almost identical logic, which will certainly impact performance.
Considering this is also a security feature - it should probably not be left to every developer on it's own to figure out.
Contributor guide
No contributing guide indexed for this repository
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 reading the auth-redirect plugin's existing redirect behavior and the linked Supabase MFA documentation, especially the challenge step and getAuthenticatorAssuranceLevel flow. Done means an optional, configurable route redirects users from aal1 to aal2 when MFA is required, without affecting users who do not need it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nuxt, supabase, typescript
- Domain
- authentication
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100