stack/apps
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
..
backend Improve OAuth error handling and access token refresh (#748) 2025-07-09 21:14:02 +02:00
dashboard chore: update package versions 2025-07-09 09:27:32 -07:00
dev-launchpad chore: update package versions 2025-07-09 09:27:32 -07:00
e2e chore: update package versions 2025-07-09 09:27:32 -07:00
mcp-server chore: update package versions 2025-07-09 09:27:32 -07:00
mock-oauth-server chore: update package versions 2025-07-09 09:27:32 -07:00
oauth-mock-server In-source unit tests (#429) 2025-02-14 11:47:52 -08:00