mardi 19 juin 2018

Redirect back to application 3rd party auth using middleware

I'm trying to authenticate using a 3rd party service via middleware, without creating a dedicated controller and method to link from the route.

When I test the snippet below I get Route [login] has no method which is expected.

Route:

Route::group(['middleware' => ['goHereToAuth']], function () {
    Route::get('login')->name('loginRoute');
});

Link:

<a href="">Login</a>

When I try Route like this:

Route::group(['middleware' => ['goHereToAuth']], function () {
    Route::get('login', function()
    {
        return redirect()->back();
    })->name('loginRoute');
});

I get a redirect loop because of how goHereToAuth works.

Is there a way I can link directly to the respective middleware action of goHereToAuth from the blade link or some other way? (I don't know)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire