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

Support configured sessions #2221

Open
pi0 opened this issue Mar 6, 2024 · 2 comments
Open

Support configured sessions #2221

pi0 opened this issue Mar 6, 2024 · 2 comments
Labels
discussion enhancement New feature or request

Comments

@pi0
Copy link
Member

pi0 commented Mar 6, 2024

H3 provides a useSession(event, config) utility which is useful to support authentication flows however its usage within Nitro apps is not intuitive because config needs to be manually handled and added.

We can support a Nitro configuration (which can be overridden with conventional runtime configs) for configured sessions.

To be used for upcoming h3 useSession(event, name = "default") (unjs/h3#693)

@pi0 pi0 added enhancement New feature or request discussion labels Mar 6, 2024
@Atinux
Copy link
Member

Atinux commented Mar 6, 2024

So we could set this runtimeConfig:

runtimeConfig: {
  session: {
    default: {
      name: 'my-session',
      password: 'my-password-for-default-session'
    }
}

Looks great to me!

@pi0
Copy link
Member Author

pi0 commented Mar 6, 2024

Ye. I think putting the session definitions in nitro.config (or nuxt.config) And only for password use runtimeConfig/process.env.SERVER_SESSION_DEFAULT_PASSWORD.

Having definitions at built-time we can have more integrations and better predictable behavior for example for generating OpenAPI docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants