grosv/laravel-passwordless-login

Does not Work on production

thorvh opened this issue · 3 comments

Hi,
thanks for your package.

It works very well on my localhost...

this is my function on Controller

function sendLoginLink()
    {
        $user = User::find(2);

        $generator = new LoginUrl($user);
        $generator->setRedirectUrl('/home'); // Override the default url to redirect to after login

        return $generator->generate();
    }

which returns this link

http://127.0.0.1:8000/magic-login/2?expires=1615255572&redirect_to=%2Fhome&user_type=app-user&signature=a6255a266fd1568108f5309876aeb8fc416204b1088bb379c050558bde834f81

On live production I got this error:

Symfony\Component\Routing\Exception\RouteNotFoundException Route [] not defined.

I made a few attempts and realized that the error is generated by $generator->generate();
I don't understand why..

I was getting the same error. Running this fixed it for me:
php artisan config:cache
php artisan cache:clear
php artisan route:cache

xtfer commented

For anyone else hitting this, it is likely because you haven't published the config (or added the environment variables as documented).

Run php artisan vendor:publish and choose passwordless-login-config.

I was able to fix the issue by adding target="_blank" in my mail template on the verify link / button