laravel-localization icon indicating copy to clipboard operation
laravel-localization copied to clipboard

Signed URL in notification not working with localized route

Open YannikFirre opened this issue 4 years ago • 7 comments

Describe the bug When i use signed url on localized url in notification, it's doesn't work.

To Reproduce

Route::group([
    'prefix' => \Mcamara\LaravelLocalization\Facades\LaravelLocalization::setLocale(),
    'middleware' => ['localeSessionRedirect'],
], static function () {
Route::get('test', function() {
  return "test";
})
    ->middleware('signed')
    ->name('test');
});

URL::signedRoute('test'); works in view but not in notification when called in toArray method.

Expected behavior The toRoute method called in signedURL return the uri without the locale.

More info:

  • Laravel 7.25
  • Laravel-localization 1.5.0

Thanks for any help :D

YannikFirre avatar Aug 12 '20 15:08 YannikFirre

Having the same issue. @YannikFirre did you find a solution?

juliancc avatar Apr 01 '21 13:04 juliancc

Hello,

No, finally, my route did not need to be localized.

Sorry :/

YannikFirre avatar Apr 01 '21 15:04 YannikFirre

Same problem for us, if we generate a signed route and we visit it without the language code is working, if we add the language code to url we receive a 401 error.

MattiaMarchiorato avatar Sep 01 '21 08:09 MattiaMarchiorato

Same issue here. If it's a queued notification that contains a signedRoute, the route in the email is generated is without the locale en therefore invalid as the server auto redirects it to the currentLocale.

yordivd avatar Dec 24 '21 11:12 yordivd

I have the same problem with the verify route and queued mail. One solution it`s custom logic for UrlGenerator::temporarySignedRoute

kofeinstyle avatar Oct 04 '22 13:10 kofeinstyle

I fixed it puting LaravelLocalization::setLocale() before to use URL::signedRoute

wilfredot avatar Apr 20 '23 17:04 wilfredot

just add the path of route to ignored array in laravellocalization.php config file

'urlsIgnored' => ['/skipped', '/backend/email/verify/*'],

hatem-elsheref avatar Nov 01 '23 02:11 hatem-elsheref