gushonorato

gushonorato

Hey everyone! :waving_hand:

I’m excited to share a new library with you all: Magic Auth! It’s an authentication library for Phoenix projects that aims to make your life as a developer easier by offering an authentication solution with minimal setup effort.

Why I Built Magic Auth

While phx.gen.auth is amazing, it can require a significant amount of time to implement all the necessary flows, such as password resets, recovery screens, and UI customization. Magic Auth is designed to simplify authentication, requiring virtually the same minimal effort as implementing a BASIC HTTP authentication flow, but with much more power!

What Magic Auth Brings to the Table

Here’s a quick rundown of the key features:

• Ship Faster :rocket:: No time wasted configuring password resets and recovery flows—just implement and ship your product.

• Passwordless Authentication :incoming_envelope:: Secure login process through one-time passwords sent via email. One-time passwords are better than magic links because users can receive the code on one device (e.g., phone email) and enter it on another (e.g., desktop browser).

• Enhanced Security :locked:: Protect your application from brute force attacks with built-in rate limiting and account lockout mechanisms.

• Customizable Interface :artist_palette:: Use the beautiful default UI components out of the box, or customize them fully to match your design perfectly.

• Effortless Configuration and Comprehensive Documentation :books:: Quick and simple integration with your Phoenix project, with detailed guides and references to assist you through every step of the integration process.

• Schema Agnostic :bust_in_silhouette:: Implement authentication without requiring a user schema—ideal for everything from MVPs to complex applications.

Why This Matters

I’m deeply passionate about making the Elixir/Phoenix ecosystem the go-to choice for building MVPs and startups. I truly believe Elixir and Phoenix have unmatched potential for speed, scalability, and developer happiness.

Authentication can often be a roadblock, especially when you’re moving fast to validate ideas or launch a product. Magic Auth removes that friction so you can spend less time on boilerplate and more time building something awesome.

Check out Magic Auth on GitHub: GitHub - gushonorato/magic_auth: An Elixir authentication library designed for effortless setup. · GitHub. Give it a try, and let me know your thoughts! Your feedback can help shape Magic Auth into an even better tool for the community.

Let’s make the Elixir/Phoenix ecosystem the best place to build startups and MVPs.

Cheers,
Gustavo

P.S. Feel free to ask questions or share your thoughts. I’d love to hear how Magic Auth can help your projects! :blush:

https://github.com/gushonorato/magic_auth

Showing Posts 1 to 10

nix2intel

nix2intel

Will this support totp in the future where i can setup a phone or passkey for auth? Looks amazing btw.

gushonorato

gushonorato OP

Thank you for your feedback! I believe that with just a few modifications, I can add support for sending TOTP to a phone instead of email. Could you please open an issue on GitHub describing your use case?

nix2intel

nix2intel

Did so, and seriously great work!

3even

3even

Very impressed with the quality of your code, comments and documentation. Thank you!

Wojciech

Wojciech

Amazing! Magic auth is exactly what i imagined the perfect auth library to be.

Thanks for your great work!

gushonorato

gushonorato OP

[Release] Version 0.1.1 – Important Security Fix

Hello everyone,

We’ve just released version 0.1.1, and we strongly recommend updating to this latest version as it includes a critical security fix.

[0.1.1] - 2025-01-29

Fixed

  • One-time passwords are not being deleted after verified, allowing them to be reused multiple times until they expire.

Please update as soon as possible and let us know if you have any feedback! :rocket:

Thanks for your support!

sreyansjain

sreyansjain

Great work. Congratulations and Thank you.
Do you have any guide about using Magic Auth without liveview?
I wan’t to use Magic Auth with phoenix controllers and (dead) views. Please advise.

gushonorato

gushonorato OP

Hey! Unfortunately, Magic Auth does require LiveView. However, adding support for “dead views only projects” isn’t too difficult. Could you please open an issue on GitHub so we can continue the discussion there? If possible, provide details about your use case in the issue.

gushonorato

gushonorato OP

Release 0.2.0

Hey everyone! I’m excited to announce the release of Magic Auth v0.2.0, packed with several improvements and new features.

:sparkles: Enhancements

  • Multi-tenancy support via query prefixes and foreign keys.
  • Improved error messaging when mix magic_auth.install fails to inject code into the necessary files.
  • You can now return a tuple like {:allow, user_id} from the log_in_requested/1 callback. Magic Auth will store the user ID in %Session{user_id: user_id}, and fetch_magic_auth_session/2 will automatically load and assign the user to :current_user.
  • Default logging for success and error messages in the generated email-sending code.
  • New test helpers to streamline testing. Check out the Testing Guide for details.

:warning: This version includes breaking changes. Make sure to review the Changelog for migration instructions.

mindreframer

mindreframer

I wanted to use Magic Auth for an app, that requires different Auth routers for different users. As it is right now, it was not possible to implement. The configuration is a global singleton.

To solve it I have used the ProcessTree package, which allows quasi-global configuration per request. Liveviews required some special treatment with on_mount callbacks. But it seems to be working quite OK right now in my local setup.

Here is the branch on the fork:

And here PR: Feat: support for multiple different magic_auth configuration in the same application. by mindreframer · Pull Request #5 · gushonorato/magic_auth · GitHub

Where Next? Top

Trending in Announcing Top

type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New
GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
ahamez
Hi everyone, I’ve been working on this protobuf library for 3 years. We use it in the company I work for, EasyMile, to communicate with ...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
kip
I’ll shortly be launching Text, a nascent text analysis library. Current functionality In this early version (not ready for prime time) ...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New
bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews