Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in cookie #72

Open
winkelco opened this issue Nov 18, 2022 · 0 comments
Open

Error in cookie #72

winkelco opened this issue Nov 18, 2022 · 0 comments

Comments

@winkelco
Copy link

winkelco commented Nov 18, 2022

Hi guys. I think I found a problem with the Footprinter.php file.

on the line 21 we have this function

public function footprint(Request $request): string
{
        $this->request = $request;

        if ($request->hasCookie(config('footprints.cookie_name'))) {
            return $request->cookie(config('footprints.cookie_name'));
        }

        // This will add the cookie to the response
        Cookie::queue(
            config('footprints.cookie_name'),
            $footprint = substr($this->fingerprint(), 0, 255),
            config('footprints.attribution_duration'),
            null,
            config('footprints.cookie_domain')
        );

        return $footprint;
}

the problem is in the line 32 because laravel make a cookie encryptation and then the first request returns the value stored in the variable $footprint

but the second request returns the cookie value encrypted

my solution was to add the cookie name in the EncryptCookies middleware and so we prevent laravel from changing the value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant