-
When using email magic links, TOTP code, or SMS code, or any method where the user does not provide a password, how to sign in the user using |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
@ellmetha, is it possible with the current implementation? |
Beta Was this translation helpful? Give feedback.
-
@notramo Yes, it is possible with the current implementation and marten-auth allows you to do that easily. You just need to call the For example: # At sign up time.
user = User.new(...)
user.set_unusable_password
user.save!
# At sign in time.
MartenAuth.sign_in(user, request) This technique is used by other shards that provide passwordless authentication, such as |
Beta Was this translation helpful? Give feedback.
@notramo Yes, it is possible with the current implementation and marten-auth allows you to do that easily. You just need to call the
User#set_unusable_password
method when creating your user record and then callMartenAuth#sign_in
with yourUser
record and the current request object at sign in time.For example:
This technique is used by other shards that provide passwordless authentication, such as
msa7/multi_auth
. You can check out the Marten example in this repository for a more concrete example.