diff --git a/.changeset/shaggy-bees-search.md b/.changeset/shaggy-bees-search.md new file mode 100644 index 0000000000..f9051bc013 --- /dev/null +++ b/.changeset/shaggy-bees-search.md @@ -0,0 +1,5 @@ +--- +'@directus/api': patch +--- + +Added missing share ID when refreshing/updating share sessions diff --git a/api/src/services/authentication.ts b/api/src/services/authentication.ts index 56107840a5..ef81519149 100644 --- a/api/src/services/authentication.ts +++ b/api/src/services/authentication.ts @@ -417,7 +417,10 @@ export class AuthenticationService { // Clear expired sessions for the current user await this.knex('directus_sessions') .delete() - .where('user', '=', record.user_id) + .where({ + user: record.user_id, + share: record.share_id, + }) .andWhere('expires', '<', new Date()); return { @@ -476,6 +479,7 @@ export class AuthenticationService { await this.knex('directus_sessions').insert({ token: newSessionToken, user: sessionRecord['user_id'], + share: sessionRecord['share_id'], expires: sessionExpiration, ip: this.accountability?.ip, user_agent: this.accountability?.userAgent,