stack/apps/backend/prisma
Zai Shi f32921f17c
Making OAuth token refresh more robust (#767)
…oken validity handling in CRUD operations

<!--

Make sure you've read the CONTRIBUTING.md guidelines:
https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md

-->

<!-- ELLIPSIS_HIDDEN -->

----

> [!IMPORTANT]
> Enhances OAuth token handling by adding validity checks, marking
invalid tokens, and attempting token refreshes in `crud.tsx`.
> 
>   - **Behavior**:
> - Adds `isValid` column to `OAuthAccessToken` and `OAuthToken` in
`migration.sql` and `schema.prisma`.
> - In `crud.tsx`, filters tokens by `isValid` status and marks them
invalid if server-side checks fail.
> - Attempts to refresh tokens if no valid access token is found,
logging errors and marking refresh tokens invalid if refresh fails.
>   - **Error Handling**:
>     - Uses `captureError` to log token refresh errors in `crud.tsx`.
>   - **Misc**:
>     - Imports `TokenSet` and `captureError` in `crud.tsx`.
> 
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup>
for a45b64f98e. You can
[customize](https://app.ellipsis.dev/stack-auth/settings/summaries) this
summary. It will automatically update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->

---------

Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2025-07-16 23:00:22 +02:00
..
migrations Making OAuth token refresh more robust (#767) 2025-07-16 23:00:22 +02:00
schema.prisma Making OAuth token refresh more robust (#767) 2025-07-16 23:00:22 +02:00
seed.ts Source of Truth (#660) 2025-07-11 17:59:03 -07:00
tsup.config.ts Config DB migration step 2 (#629) 2025-04-29 14:52:45 -07:00