Skip to content

Unable to register catchall route and use restify at the same time #611

Closed Answered by martin-juul
martin-juul asked this question in Q&A
Discussion options

You must be logged in to vote

Ahh error on my side. Restify renames the sanctum login route to restify.login. In the Authenticate middleware my redirect route by default expected it to be named login:

<?php

namespace App\Http\Middleware;

use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Illuminate\Http\Request;

class Authenticate extends Middleware
{
    /**
     * Get the path the user should be redirected to when they are not authenticated.
     */
    protected function redirectTo(Request $request): ?string
    {
        return $request->expectsJson() ? null : route('login');
    }
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by martin-juul
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant