From bde071549c03f0205171be474e93abfbd610bc44 Mon Sep 17 00:00:00 2001 From: pilcrow Date: Fri, 22 Dec 2023 11:54:57 +0900 Subject: [PATCH 1/6] Fix Redis adapter expiration (#1314) --- .auri/$vkd6ut3c.md | 6 ++++++ packages/adapter-session-redis/src/drivers/ioredis.ts | 4 ++-- packages/adapter-session-redis/src/drivers/redis.ts | 4 ++-- packages/adapter-session-redis/src/drivers/upstash.ts | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 .auri/$vkd6ut3c.md diff --git a/.auri/$vkd6ut3c.md b/.auri/$vkd6ut3c.md new file mode 100644 index 000000000..d26634709 --- /dev/null +++ b/.auri/$vkd6ut3c.md @@ -0,0 +1,6 @@ +--- +package: "@lucia-auth/adapter-session-redis" # package name +type: "patch" # "major", "minor", "patch" +--- + +Fix expiration \ No newline at end of file diff --git a/packages/adapter-session-redis/src/drivers/ioredis.ts b/packages/adapter-session-redis/src/drivers/ioredis.ts index 0dcaf2e13..f844f78aa 100644 --- a/packages/adapter-session-redis/src/drivers/ioredis.ts +++ b/packages/adapter-session-redis/src/drivers/ioredis.ts @@ -45,7 +45,7 @@ export const ioredisSessionAdapter = ( client.set( sessionKey(session.id), JSON.stringify(session), - "EX", + "EXAT", Math.floor(Number(session.idle_expires) / 1000) ) ]); @@ -77,7 +77,7 @@ export const ioredisSessionAdapter = ( await client.set( sessionKey(sessionId), JSON.stringify(updatedSession), - "EX", + "EXAT", Math.floor(Number(updatedSession.idle_expires) / 1000) ); } diff --git a/packages/adapter-session-redis/src/drivers/redis.ts b/packages/adapter-session-redis/src/drivers/redis.ts index d2aec0969..e6dc65719 100644 --- a/packages/adapter-session-redis/src/drivers/redis.ts +++ b/packages/adapter-session-redis/src/drivers/redis.ts @@ -43,7 +43,7 @@ export const redisSessionAdapter = ( await Promise.all([ client.sAdd(userSessionsKey(session.user_id), session.id), client.set(sessionKey(session.id), JSON.stringify(session), { - EX: Math.floor(Number(session.idle_expires) / 1000) + EXAT: Math.floor(Number(session.idle_expires) / 1000) }) ]); }, @@ -75,7 +75,7 @@ export const redisSessionAdapter = ( sessionKey(sessionId), JSON.stringify(updatedSession), { - EX: Math.floor(Number(updatedSession.idle_expires) / 1000) + EXAT: Math.floor(Number(updatedSession.idle_expires) / 1000) } ); } diff --git a/packages/adapter-session-redis/src/drivers/upstash.ts b/packages/adapter-session-redis/src/drivers/upstash.ts index e315b4a75..f5d67d9a0 100644 --- a/packages/adapter-session-redis/src/drivers/upstash.ts +++ b/packages/adapter-session-redis/src/drivers/upstash.ts @@ -50,7 +50,7 @@ export const upstashSessionAdapter = ( const pipeline = upstashClient.pipeline(); pipeline.sadd(userSessionsKey(session.user_id), session.id); pipeline.set(sessionKey(session.id), JSON.stringify(session), { - ex: Math.floor(Number(session.idle_expires) / 1000) + exat: Math.floor(Number(session.idle_expires) / 1000) }); await pipeline.exec(); }, @@ -85,7 +85,7 @@ export const upstashSessionAdapter = ( sessionKey(sessionId), JSON.stringify(updatedSession), { - ex: Math.floor(Number(updatedSession.idle_expires) / 1000) + exat: Math.floor(Number(updatedSession.idle_expires) / 1000) } ); } From 92b4535d5eabbb4cea03b086bbfdb20cd826cd31 Mon Sep 17 00:00:00 2001 From: "Lucy (bot)" <126932300+lucythecat@users.noreply.github.com> Date: Fri, 22 Dec 2023 11:59:15 +0900 Subject: [PATCH 2/6] CI: Release (#1310) --- .auri/$vkd6ut3c.md | 6 ------ .auri/$ypf7ombn.md | 6 ------ packages/adapter-session-redis/CHANGELOG.md | 6 ++++++ packages/adapter-session-redis/package.json | 2 +- packages/lucia/CHANGELOG.md | 6 ++++++ packages/lucia/package.json | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) delete mode 100644 .auri/$vkd6ut3c.md delete mode 100644 .auri/$ypf7ombn.md diff --git a/.auri/$vkd6ut3c.md b/.auri/$vkd6ut3c.md deleted file mode 100644 index d26634709..000000000 --- a/.auri/$vkd6ut3c.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -package: "@lucia-auth/adapter-session-redis" # package name -type: "patch" # "major", "minor", "patch" ---- - -Fix expiration \ No newline at end of file diff --git a/.auri/$ypf7ombn.md b/.auri/$ypf7ombn.md deleted file mode 100644 index 3a432e838..000000000 --- a/.auri/$ypf7ombn.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -package: "lucia" # package name -type: "patch" # "major", "minor", "patch" ---- - -Fix `setCookie()` method in SvelteKit middleware \ No newline at end of file diff --git a/packages/adapter-session-redis/CHANGELOG.md b/packages/adapter-session-redis/CHANGELOG.md index 5f3f28ae8..1683f0c7b 100644 --- a/packages/adapter-session-redis/CHANGELOG.md +++ b/packages/adapter-session-redis/CHANGELOG.md @@ -1,5 +1,11 @@ # @lucia-auth/adapter-session-redis +## 2.1.2 + +### Patch changes + +- [#1314](https://github.com/lucia-auth/lucia/pull/1314) by [@pilcrowOnPaper](https://github.com/pilcrowOnPaper) : Fix expiration + ## 2.1.1 ### Patch changes diff --git a/packages/adapter-session-redis/package.json b/packages/adapter-session-redis/package.json index 474ea68c4..632654c20 100644 --- a/packages/adapter-session-redis/package.json +++ b/packages/adapter-session-redis/package.json @@ -1,6 +1,6 @@ { "name": "@lucia-auth/adapter-session-redis", - "version": "2.1.1", + "version": "2.1.2", "description": "Redis session adapter for Lucia", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/lucia/CHANGELOG.md b/packages/lucia/CHANGELOG.md index f8f36bb52..4be98df6b 100644 --- a/packages/lucia/CHANGELOG.md +++ b/packages/lucia/CHANGELOG.md @@ -1,5 +1,11 @@ # lucia +## 2.7.6 + +### Patch changes + +- [#1309](https://github.com/lucia-auth/lucia/pull/1309) by [@pilcrowOnPaper](https://github.com/pilcrowOnPaper) : Fix `setCookie()` method in SvelteKit middleware + ## 2.7.5 ### Patch changes diff --git a/packages/lucia/package.json b/packages/lucia/package.json index 298ddad22..7b43c1434 100644 --- a/packages/lucia/package.json +++ b/packages/lucia/package.json @@ -1,6 +1,6 @@ { "name": "lucia", - "version": "2.7.5", + "version": "2.7.6", "description": "A simple and flexible authentication library", "main": "dist/index.js", "types": "dist/index.d.ts", From 83960e28021d3515aa0144f70906cc09740a1f97 Mon Sep 17 00:00:00 2001 From: Braden Wong <13159333+braden-w@users.noreply.github.com> Date: Sun, 24 Dec 2023 15:02:41 -0800 Subject: [PATCH 3/6] fix: use transformDatabaseUser in transformDatabaseUser example (#1315) --- documentation/content/reference/lucia/interfaces/auth.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/content/reference/lucia/interfaces/auth.md b/documentation/content/reference/lucia/interfaces/auth.md index fb460a3d6..a04668550 100644 --- a/documentation/content/reference/lucia/interfaces/auth.md +++ b/documentation/content/reference/lucia/interfaces/auth.md @@ -669,7 +669,7 @@ const transformDatabaseUser: (databaseUser: UserSchema) => User; import { auth } from "./lucia.js"; const databaseUser = await db.getUser(userId); -const user = auth.transformDatabaseSession(databaseUser); +const user = auth.transformDatabaseUser(databaseUser); ``` ## `updateKeyPassword()` From 5685ab9931fed3e9b8af78e3ebda1308c2be0139 Mon Sep 17 00:00:00 2001 From: Jan Lecoutere Date: Sun, 7 Jan 2024 03:05:14 +0100 Subject: [PATCH 4/6] Fix dropbox provider (#1323) --- packages/oauth/src/providers/dropbox.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/oauth/src/providers/dropbox.ts b/packages/oauth/src/providers/dropbox.ts index 12f8a4c89..713d7f294 100644 --- a/packages/oauth/src/providers/dropbox.ts +++ b/packages/oauth/src/providers/dropbox.ts @@ -68,7 +68,7 @@ export class DropboxAuth<_Auth extends Auth = Auth> extends OAuth2ProviderAuth< access_token: string; expires_in: number; refresh_token?: string; - }>(code, "https://www.dropbox.com/oauth2/token", { + }>(code, "https://api.dropboxapi.com/oauth2/token", { clientId: this.config.clientId, redirectUri: this.config.redirectUri, clientPassword: { @@ -106,6 +106,7 @@ const getDropboxUser = async (accessToken: string): Promise => { const request = new Request( "https://api.dropboxapi.com/2/users/get_current_account", { + method: "POST", headers: { Authorization: authorizationHeader("bearer", accessToken) } From 98cd659808a1de6cd594f1272b8d30ad828eaace Mon Sep 17 00:00:00 2001 From: pilcrowOnPaper Date: Sun, 7 Jan 2024 11:21:56 +0900 Subject: [PATCH 5/6] add changeset --- .auri/$skstsn5z.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .auri/$skstsn5z.md diff --git a/.auri/$skstsn5z.md b/.auri/$skstsn5z.md new file mode 100644 index 000000000..6b126df3a --- /dev/null +++ b/.auri/$skstsn5z.md @@ -0,0 +1,6 @@ +--- +package: "lucia" # package name +type: "patch" # "major", "minor", "patch" +--- + +Fix Dropbox provider \ No newline at end of file From c88691cba22713e37124745afb13bbc6a0e43f6a Mon Sep 17 00:00:00 2001 From: pilcrowOnPaper Date: Sun, 7 Jan 2024 11:23:03 +0900 Subject: [PATCH 6/6] fix changeset --- .auri/$skstsn5z.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.auri/$skstsn5z.md b/.auri/$skstsn5z.md index 6b126df3a..b4debc59e 100644 --- a/.auri/$skstsn5z.md +++ b/.auri/$skstsn5z.md @@ -1,6 +1,7 @@ --- -package: "lucia" # package name +package: "@lucia-auth/oauth" # package name type: "patch" # "major", "minor", "patch" +pull: "1323" --- Fix Dropbox provider \ No newline at end of file