-
-
Notifications
You must be signed in to change notification settings - Fork 512
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Rob Marscher <[email protected]> Co-authored-by: Howard Dean Watts <[email protected]> Co-authored-by: SkepticMystic <[email protected]> Co-authored-by: Aayush <[email protected]> Co-authored-by: Alejandro Perez Pujante <[email protected]> Co-authored-by: Corliansa Kusumah <[email protected]> Co-authored-by: Gabriel Lucena <[email protected]> Co-authored-by: Mihovil Ilakovac <[email protected]> Co-authored-by: Linus <[email protected]> Co-authored-by: Andrew Smith <[email protected]> Co-authored-by: Matt Lehrer <[email protected]> Co-authored-by: Bogdan Mardale <[email protected]> Co-authored-by: Žan Fras <[email protected]> Co-authored-by: Mr. Mendez <[email protected]> Co-authored-by: Elliot Waite <[email protected]>
- Loading branch information
1 parent
f073be1
commit beac8bc
Showing
528 changed files
with
12,075 additions
and
42,313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: "Publish v3 docs" | ||
on: | ||
push: | ||
branches: | ||
- v3 | ||
|
||
env: | ||
CLOUDFLARE_API_TOKEN: ${{secrets.CLOUDFLARE_PAGES_API_TOKEN}} | ||
|
||
jobs: | ||
publish-docs: | ||
name: Publish docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: setup actions | ||
uses: actions/checkout@v3 | ||
- name: setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.5.1 | ||
registry-url: https://registry.npmjs.org | ||
- name: install malta | ||
working-directory: docs | ||
run: | | ||
curl -o malta.tgz -L https://github.com/pilcrowonpaper/malta/releases/latest/download/linux-amd64.tgz | ||
tar -xvzf malta.tgz | ||
- name: build | ||
working-directory: docs | ||
run: ./linux-amd64/malta build | ||
- name: install wrangler | ||
run: npm i -g wrangler | ||
- name: deploy | ||
run: wrangler pages deploy docs/dist --project-name lucia-v3 --branch main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: "Publish v2 docs" | ||
on: | ||
push: | ||
branches: | ||
- v2 | ||
|
||
env: | ||
CLOUDFLARE_API_TOKEN: ${{secrets.CLOUDFLARE_PAGES_API_TOKEN}} | ||
|
||
jobs: | ||
publish-docs: | ||
name: Publish docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: setup actions | ||
uses: actions/checkout@v3 | ||
- name: setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.5.1 | ||
registry-url: https://registry.npmjs.org | ||
- name: Install PNPM | ||
run: npm i -g pnpm | ||
- name: Install dependencies | ||
run: pnpm i | ||
- name: Build | ||
working-directory: documentation | ||
run: pnpm build | ||
- name: Install wrangler | ||
run: npm i -g wrangler | ||
- name: deploy | ||
working-directory: documentation | ||
run: wrangler pages deploy dist --project-name lucia-v2 --branch v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"name": "Lucia", | ||
"description": "Lucia is an open source auth library that abstracts away the complexity of handling sessions.", | ||
"domain": "https://v3.lucia-auth.com", | ||
"twitter": "@lucia_auth", | ||
"sidebar": [ | ||
{ | ||
"title": "Start here", | ||
"pages": [ | ||
["Getting-started", "/getting-started"], | ||
["Database", "/database"], | ||
["Upgrade to v3", "/upgrade-v3"], | ||
["v2 documentation", "https://v2.lucia-auth.com"] | ||
] | ||
}, | ||
{ | ||
"title": "Tutorials", | ||
"pages": [ | ||
["GitHub OAuth", "/tutorials/github-oauth"], | ||
["Username and password", "/tutorials/username-and-password"] | ||
] | ||
}, | ||
{ | ||
"title": "Basics", | ||
"pages": [ | ||
["Sessions", "/basics/sessions"], | ||
["Users", "/basics/users"], | ||
["Configuration", "/basics/configuration"] | ||
] | ||
}, | ||
{ | ||
"title": "Guides", | ||
"pages": [ | ||
["Validate session cookies", "/guides/validate-session-cookies"], | ||
["Validate bearer tokens", "/guides/validate-bearer-tokens"], | ||
["OAuth", "/guides/oauth"], | ||
["Email and password", "/guides/email-and-password"], | ||
["Troubleshooting", "/guides/troubleshooting"], | ||
["Passkeys", "/guides/passkeys"], | ||
["Improving sessions", "/guides/improving-sessions"] | ||
] | ||
}, | ||
{ | ||
"title": "API reference", | ||
"pages": [["lucia", "/reference/main", "code"]] | ||
}, | ||
{ | ||
"title": "Community", | ||
"pages": [ | ||
["Discord", "https://discord.com/invite/PwrK3kpVR3"], | ||
["GitHub", "https://github.com/lucia-auth/lucia"], | ||
["Twitter", "https://twitter.com/lucia_auth"] | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
--- | ||
title: "Configuration" | ||
--- | ||
|
||
# Configuration | ||
|
||
This page shows all the options for [`Lucia`](/reference/main/Lucia) to configure Lucia. | ||
|
||
```ts | ||
interface Options { | ||
sessionExpiresIn?: TimeSpan; | ||
sessionCookie?: SessionCookieOptions; | ||
getSessionAttributes?: ( | ||
databaseSessionAttributes: DatabaseSessionAttributes | ||
) => _SessionAttributes; | ||
getUserAttributes?: (databaseUserAttributes: DatabaseUserAttributes) => _UserAttributes; | ||
} | ||
``` | ||
|
||
## `sessionExpiresIn` | ||
|
||
Configures how long a session stays valid for inactive users. Session expirations are automatically extended for active users. Also see [`TimeSpan`](/reference/main/TimeSpan). | ||
|
||
```ts | ||
import { Lucia, TimeSpan } from "lucia"; | ||
|
||
const lucia = new Lucia(adapter, { | ||
sessionExpiresIn: new TimeSpan(2, "w") | ||
}); | ||
``` | ||
|
||
## `sessionCookie` | ||
|
||
Configures the session cookie. | ||
|
||
```ts | ||
import { Lucia } from "lucia"; | ||
|
||
const lucia = new Lucia(adapter, { | ||
sessionCookie: { | ||
name: "session", | ||
expires: false, // session cookies have very long lifespan (2 years) | ||
attributes: { | ||
secure: true, | ||
sameSite: "strict", | ||
domain: "example.com" | ||
} | ||
} | ||
}); | ||
``` | ||
|
||
## `getSessionAttributes()` | ||
|
||
Transforms database session attributes, which is typed as `DatabaseSessionAttributes`. The returned object is added to the `Session` object. | ||
|
||
```ts | ||
import { Lucia } from "lucia"; | ||
|
||
const lucia = new Lucia(adapter, { | ||
getSessionAttributes: (attributes) => { | ||
return { | ||
country: attributes.country | ||
}; | ||
} | ||
}); | ||
|
||
declare module "lucia" { | ||
interface Register { | ||
Lucia: typeof lucia; | ||
DatabaseSessionAttributes: DatabaseSessionAttributes; | ||
} | ||
} | ||
|
||
interface DatabaseSessionAttributes { | ||
country: string; | ||
} | ||
``` | ||
|
||
## `getUserAttributes()` | ||
|
||
Transforms database user attributes, which is typed as `DatabaseUserAttributes`. The returned object is added to the `User` object. | ||
|
||
```ts | ||
import { Lucia } from "lucia"; | ||
|
||
const lucia = new Lucia(adapter, { | ||
getUserAttributes: (attributes) => { | ||
return { | ||
username: attributes.username | ||
}; | ||
} | ||
}); | ||
|
||
declare module "lucia" { | ||
interface Register { | ||
Lucia: typeof lucia; | ||
DatabaseUserAttributes: DatabaseUserAttributes; | ||
} | ||
} | ||
|
||
interface DatabaseUserAttributes { | ||
username: string; | ||
} | ||
``` |
Oops, something went wrong.