stack/packages
BilalG1 e15ed03d3c
oauth sign in scope and test (#887)
<!--

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

-->

<!-- ELLIPSIS_HIDDEN -->

----

> [!IMPORTANT]
> Adds `provider_scope` handling to OAuth requests and tests it in a new
`oauth.test.ts` file.
> 
>   - **Behavior**:
> - Adds `provider_scope` handling in `getOAuthUrl()` in
`client-interface.ts` for OAuth requests.
> - New test `oauth.test.ts` to verify `provider_scope` is set correctly
during OAuth sign-in.
>   - **Functions**:
> - Modifies `getOAuthUrl()` in `client-interface.ts` to always set
`provider_scope` if provided.
>   - **Tests**:
> - Adds `oauth.test.ts` to test `provider_scope` addition in OAuth
sign-in flow.
> - Updates `createApp()` in `js-helpers.ts` to accept `appOverrides`
for client and server configurations.
> 
> <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 1873f395b8. You can
[customize](https://app.ellipsis.dev/stack-auth/settings/summaries) this
summary. It will automatically update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->

<!-- RECURSEML_SUMMARY:START -->
## Review by RecurseML

_🔍 Review performed on
[1596315..1873f39](15963155e8...1873f395b8)_

| Severity | Location | Issue | Action |
|----------|----------|-------|--------|
| ![Medium](https://img.shields.io/badge/Medium-yellow?style=plastic) |
[apps/e2e/tests/js/oauth.test.ts:49](https://github.com/stack-auth/stack-auth/pull/887#discussion_r2335145911)
| Non-null assertion used instead of ?? throwErr pattern |
[![Dismiss](d1f3c6917f/?repo_owner=stack-auth&repo_name=stack-auth&pr_number=887)
|
| ![Medium](https://img.shields.io/badge/Medium-yellow?style=plastic) |
[apps/e2e/tests/js/oauth.test.ts:51](https://github.com/stack-auth/stack-auth/pull/887#discussion_r2335145939)
| Non-null assertion used instead of ?? throwErr pattern |
[![Dismiss](23c319564c/?repo_owner=stack-auth&repo_name=stack-auth&pr_number=887)
|
| ![Medium](https://img.shields.io/badge/Medium-yellow?style=plastic) |
[apps/e2e/tests/js/oauth.test.ts:30](https://github.com/stack-auth/stack-auth/pull/887#discussion_r2335145974)
| OAuth variable missing type prefix in name |
[![Dismiss](8508261a37/?repo_owner=stack-auth&repo_name=stack-auth&pr_number=887)
|
| ![Medium](https://img.shields.io/badge/Medium-yellow?style=plastic) |
[apps/e2e/tests/js/oauth.test.ts:62](https://github.com/stack-auth/stack-auth/pull/887#discussion_r2335146011)
| Non-null assertion used instead of ?? throwErr pattern |
[![Dismiss](3dbdbb46e7/?repo_owner=stack-auth&repo_name=stack-auth&pr_number=887)
|
| ![Medium](https://img.shields.io/badge/Medium-yellow?style=plastic) |
[apps/e2e/tests/js/oauth.test.ts:63](https://github.com/stack-auth/stack-auth/pull/887#discussion_r2335146041)
| Non-null assertion used instead of ?? throwErr pattern |
[![Dismiss](94c02a9e98/?repo_owner=stack-auth&repo_name=stack-auth&pr_number=887)
|
| ![Low](https://img.shields.io/badge/Low-green?style=plastic) |
[apps/e2e/tests/js/js-helpers.ts:43](https://github.com/stack-auth/stack-auth/pull/887#discussion_r2335146078)
| Variable name 'appOverrides' should be more descriptive to better
indicate its purpose and context |
[![Dismiss](57ad8fdfe7/?repo_owner=stack-auth&repo_name=stack-auth&pr_number=887)
|

<details>
<summary> Files analyzed, no issues (1)</summary>

  • `packages/stack-shared/src/interface/client-interface.ts`
</details>

[![Need help? Join our
Discord](https://img.shields.io/badge/Need%20help%3F%20Join%20our%20Discord-5865F2?style=plastic&logo=discord&logoColor=white)](https://discord.gg/n3SsVDAW6U)
<!-- RECURSEML_SUMMARY:END -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* OAuth sign-in and linking now support specifying provider-specific
scopes. When provided, these scopes are included in the authorization
request, ensuring consistent behavior across flows.

* **Bug Fixes**
* Ensures provider-specific OAuth scopes are correctly appended to the
authorization URL whenever supplied.

* **Tests**
* Added end-to-end test validating OAuth redirect behavior and scope
handling with a GitHub provider, including verification of the resulting
authorization URL and parameters.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-09 19:21:28 -07:00
..
init-stack Fix weird formatting 2025-09-08 22:18:35 -07:00
js chore: update package versions 2025-09-03 01:38:13 -07:00
react chore: update package versions 2025-09-03 01:38:13 -07:00
stack chore: update package versions 2025-09-03 01:38:13 -07:00
stack-sc chore: update package versions 2025-09-03 01:38:13 -07:00
stack-shared oauth sign in scope and test (#887) 2025-09-09 19:21:28 -07:00
stack-ui chore: update package versions 2025-09-03 01:38:13 -07:00
template chore: update package versions 2025-09-03 01:38:13 -07:00