nuxt-modules / nuxt-modules/strapi

HTTPOnly cookie possible?

Open
#377 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
TypeScript
Stars
717
Forks
89
Avg merge
7h 3m
Merged PRs (30d)
6

Description

So, i tried to use the authentication and it worked pretty great for the most part. But when I set httpOnly for the cookies, it will not be set. What would be the reason for that? I would unterstand, that the client does not have access to that cookie, but not sure if we would need to have access anyway? I'm just worried about potential security risks.

When I try this, it works:

cookie: {
    maxAge: 14 * 24 * 60 * 60,
    secure: process.env.NODE_ENV === 'production',
    sameSite: true
}

But when I add httpOnly, then the cookie is not set. Does not work:

cookie: {
    httpOnly: true,
    maxAge: 14 * 24 * 60 * 60,
    secure: process.env.NODE_ENV === 'production',
    sameSite: true
}

I also tried various other things, like settings sameSite to lax etc. Everything works, until I set httpOnly to true.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the authentication setup with the working cookie configuration, then add httpOnly as shown in the issue and inspect the resulting cookie behavior. Trace the module's cookie-setting entry point to determine whether the option is being passed through or rejected. Done means the cause is documented and the intended httpOnly configuration works or produces a clear error.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxtjs, typescript
Domain
authentication
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.