Skip to content

Wrong expiresIn value in Cookie for Server Auth in SvelteKit course #1798

@JavierGtech

Description

@JavierGtech

I described the issue in Discord:
Fireship Discord Thread

Main thing: in the code for creating the cookie that is used for server auth in the SvelteKit course, the field expiresIn (maxAge) is already in seconds, not miliseconds. Therefore, it shouldn't be multiplied by 1000 (unless I am missing something).

Current course course
api/signin/+server.ts
...
const expiresIn = 60 * 60 * 24 * 5 * 1000; // 5 days
...

As if expiresIn (maxAge later) were in miliseconds.

Just changing it to this fixes the problem:
...
const expiresIn = 60 * 60 * 24 * 5; // * 1000; // 5 days
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions