matthiask / django-authlib

Utilities for passwordless authentication (using magic links, Google, Facebook and Twitter OAuth currently)
https://django-authlib.readthedocs.io/
MIT License
61 stars 11 forks source link

Feature request: Magic links per view #14

Closed raratiru closed 1 year ago

raratiru commented 1 year ago

Is it in the future scope of the project to allow the generation of magic links that unlock only one view, instead of entirely logging a user in?

matthiask commented 1 year ago

You can already use get_confirmation_url and decode from the authlib.email module today for this. The email_registration view probably isn't really amenable to this without customizing basically every aspect of it but you should be able to more or less follow the code structure to implement something like this. If the decode step succeeds you shouldn't login the user but instead just show the relevant data. Or maybe there's a way to solve your use case using Django permissions and additional user attributes and/or roles but that's probably more complex and quite definitely out of scope for django-authlib.

raratiru commented 1 year ago

Thank you for the well structured insights! Since the message is recorded, I am currently closing this issue.

I will share my progress on this if it becomes fruitful.