abevoelker/devise-passwordless

Is it possible to generate the magic link from another application?

alansikora opened this issue · 2 comments

I already implemented devise-passwordless on the application and it works perfectly fine, and my goal is to click on a link that is going to exist on another, non-Ruby/Rails, application. This link is going to redirect to the Rails application, already authenticated.

Any suggestions or guidance on this?

Thank you!

So, I came up with a solution: generate a token valid for each user and save it on a safe password management solution encrypted with the user's password as salt.

Then, when using it, a logged in user can decrypt with its password and have access to the magic link.

It solves this for me.

Sounds like you got it figured out but yeah you should be able to generate a login token with

Devise::Passwordless::LoginToken.encode(user)

Then transmit it securely to your other app (via private API or whatever)