Signout now works correctly with old cookies

This commit is contained in:
Stan Wohlwend 2024-06-09 18:08:10 +02:00
parent a44282239e
commit 50b2b672eb
2 changed files with 4 additions and 1 deletions

View File

@ -98,6 +98,8 @@ pnpm run prisma:server migrate reset
pnpm run dev
```
You can now open the dashboard at [http://localhost:8101](http://localhost:8101), demo on port 8103, and docs on port 8104.
Your IDE may show an error on all `@stackframe/XYZ` imports. To fix this, simply restart the TypeScript language server; for example, in VSCode you can open the command palette (Ctrl+Shift+P) and run `Developer: Reload Window` or `TypeScript: Restart TS server`.
You can also open Prisma Studio to see the database interface and edit data directly:

View File

@ -1,6 +1,6 @@
import React, { use, useCallback, useMemo } from "react";
import { KnownError, KnownErrors, OAuthProviderConfigJson, ServerUserJson, StackAdminInterface, StackClientInterface, StackServerInterface } from "@stackframe/stack-shared";
import { getCookie, setOrDeleteCookie } from "./cookie";
import { deleteCookie, getCookie, setOrDeleteCookie } from "./cookie";
import { StackAssertionError, throwErr } from "@stackframe/stack-shared/dist/utils/errors";
import { generateUuid } from "@stackframe/stack-shared/dist/utils/uuids";
import { AsyncResult, Result } from "@stackframe/stack-shared/dist/utils/results";
@ -440,6 +440,7 @@ class _StackClientAppImpl<HasTokenStore extends boolean, ProjectId extends strin
try {
setOrDeleteCookie(this._refreshTokenCookieName, value.refreshToken, { maxAge: 60 * 60 * 24 * 365 });
setOrDeleteCookie(this._accessTokenCookieName, value.accessToken, { maxAge: 60 * 60 * 24 });
deleteCookie('stack-refresh'); // delete cookie name from previous versions (for backwards-compatibility)
hasSucceededInWriting = true;
} catch (e) {
if (!isBrowserLike()) {