Skip to content

Signed Routes fails if user is logged in #27038

@NaturalDevCR

Description

@NaturalDevCR
  • Laravel Version: 5.7.19
  • PHP Version: 7.2
  • Database Driver & Version: MariaDB latest

Description: Generated signed URL's fails to 403 (Invalid Signature)

Steps To Reproduce:

  1. Login to your Laravel application with the default authentication from Laravel
  2. Generate a signed url and set your route to use the "signed" middleware...
  3. Go to the generated url while logged in, and you'll see the 403 error.
  4. Logout from your Laravel application and try again the generated signed url, now it should work.

Doubts:

Is this how is supposed to work the signed routes? what if i want to generate a temporary signed url to share some content for a limited time to my users? should they logout in order to access to this url each time? or i'm i missing something?

---------UPDATE--------

Code:

web.php

Route::get('/report/{user}/{client}', function ($user, $client) {
    return ("The user is: $user and the client is: $client");
})->name('temp.report')->middleware('signed');

genTempUrlController.php

    public function tempURL()
    {
        $tempURL= Url::temporarySignedRoute('temp.report', now('America/Costa_Rica')->addMinutes(25), [
            'user' => 1,
            'client' => 1
        ]);
        return $tempURL;
    }

The URL is generated and shows something like this:

https://example.com/report/1/1?expires=1545440368&signature=55ad67fa049a74fe8e123c664e50f53564b76154e2dd805c5927125f63c390a1

If the user is logged in the result is a 403 Forbidden (Invalid Signature) page, otherwise if the user is logged out, then the link works fine.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions