stack/apps/backend
Zai Shi 52daa84561
Improve OAuth error handling and access token refresh (#748)
<!--

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 error handling by adding access token validity checks
and improving token refresh logic across multiple providers.
> 
>   - **Behavior**:
> - Adds `checkAccessTokenValidity()` method to `OAuthBaseProvider` and
implements it in `AppleProvider`, `BitbucketProvider`,
`DiscordProvider`, `FacebookProvider`, `GithubProvider`,
`GitlabProvider`, `GoogleProvider`, `LinkedInProvider`,
`MicrosoftProvider`, `MockProvider`, `SpotifyProvider`, and `XProvider`.
> - In `crud.tsx`, checks token validity before returning it, and
refreshes if invalid.
>   - **Error Handling**:
> - In `GithubProvider`, throws `StatusError` for 403 errors when
fetching user emails due to missing permissions.
>   - **Misc**:
>     - Imports `StatusError` in `github.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 de143b1a92. 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>
2025-07-09 21:14:02 +02:00
..
prisma Send email route and notification settings page (#717) 2025-07-01 19:17:53 -07:00
scripts Remove remnants of Fern docs 2025-06-20 15:50:57 -07:00
src Improve OAuth error handling and access token refresh (#748) 2025-07-09 21:14:02 +02:00
.env Email themes (#743) 2025-07-08 17:39:17 -07:00
.env.development Email themes (#743) 2025-07-08 17:39:17 -07:00
.eslintrc.cjs tsup for stack-shared (#647) 2025-04-28 21:26:52 -07:00
.gitignore Migrations toolkit (#409) 2025-02-01 17:46:21 -08:00
CHANGELOG.md chore: update package versions 2025-07-09 09:27:32 -07:00
LICENSE Split backend and dashboard (#83) 2024-06-18 15:49:31 +02:00
next.config.mjs Fix STACK-SERVER-QP 2025-02-17 11:12:34 -08:00
package.json chore: update package versions 2025-07-09 09:27:32 -07:00
sentry.client.config.ts JS lib docs (#444) 2025-02-20 00:48:05 +01:00
tsconfig.json In-source unit tests (#429) 2025-02-14 11:47:52 -08:00
vitest.config.ts In-source unit tests (#429) 2025-02-14 11:47:52 -08:00