Commit graph inspector/client/src/lib/auth.ts
Author SHA1 Message Date
cliffhall
5323d4d8f4 Fix connect button behavior for Oauth by making sure that scope is included in client metadata when client is registered.
- In auth.ts
    - in InspectorOAuthClientProvider constructor
      - add optional scope param
      - set instance var this.scope to scope param
    - in clientMetadata getter
      - add scope param set to this.scope or ""
  - in useConnection.ts
    - in handleAuthError handler
      - move instantiation of serverAuthProvider until after scope has been determined
      - pass scope to InspectorOAuthClientProvider constructor
2025-08-15 18:40:21 -04:00
Bobby Tiernay
74900fca5d
feat: unify OAuth scope discovery between automatic and manual flows
- Add shared discoverScopes function in auth.ts with resource metadata preference
- Update automatic flow (handleAuthError) to use dynamic scope discovery
- Update manual flow (OAuth state machine) to use shared scope discovery logic
- Add comprehensive test suite for discoverScopes function (11 test cases)
- Fix empty array handling to return undefined instead of empty string
- Maintain backward compatibility with existing oauthScope parameter
- All quality gates pass: TypeScript, linting, formatting, and tests

Resolves OAuth scope discovery inconsistency where automatic flow used static
scopes while manual flow used metadata scopes. Both flows now use identical
shared logic with proper resource metadata preference.
2025-08-14 14:02:29 -04:00
Felix Weinberger
36b9acc97e
fix: filter out client_secret when storing OAuth client information 2025-08-14 17:04:38 +01:00
Cliff Hall
b4d1bc71f6
Merge branch 'main' into main 2025-08-12 16:25:42 -04:00
superboy-zjc
d21e51e6ab fix(auth): sanitize authorization URL 2025-08-12 11:26:44 -07:00
Konstantin Konstantinov
60049a5b6c
reorder methods 2025-08-12 00:29:53 +03:00
Konstantin Konstantinov
929b930618
reusable generateOAuthState helper, introduce in InspectorOAuthClientProvider and in oauth-state-machine, add test 2025-08-11 21:24:26 +03:00
Xiao Yijun
ee39d56e6d
chore: fix lint issue 2025-07-21 11:26:27 +08:00
Xiao Yijun
3b3205228f
refactor: remove resource config 2025-07-08 10:21:40 +08:00
Xiao Yijun
b8120d9f85
feat: support manual entry of OAuth client information 2025-07-08 09:41:55 +08:00
Paul Carleton
5e8e78c31d
Add Auth debugger tab (#355)
* wip auth debugger

* cleanup types and validation

* more cleanup

* draft test

* wip clean up some

* rm toasts

* consolidate state management

* prettier

* hoist state up to App

* working with quick and guided

* sort out displaying debugger

* prettier

* cleanup types

* fix tests

* cleanup comment

* prettier

* fixup types in tests

* prettier

* refactor debug to avoid toasting

* callback shuffling

* linting

* types

* rm toast in test

* bump typescript sdk version to 0.11.2 for scope parameter passing

* use proper scope handling

* test scope parameter passing

* move functions and s/sseUrl/serverUrl/

* extract status message into component

* refactor progress and steps into components

* fix test

* rename quick handler

* one less click

* last step complete

* add state machine

* test and types
2025-05-13 19:37:09 +01:00
Maxwell Gerber
1345a50011
lint 2025-04-16 16:25:51 -07:00
Maxwell Gerber
15960f5aa4
refactor: Use new serverspecifickey API 2025-04-16 16:24:49 -07:00
Maxwell Gerber
0dc6df57d6
Merge remote-tracking branch 'theirs/main' into max/disconnect 2025-04-16 16:10:35 -07:00
Glen Maddern
df0b526a41 fix: store auth tokens with server-specific keys
Changes client information and access tokens to use server-specific keys in sessionStorage. This fixes issues where changing the server URL would try to use tokens from a different server.
2025-04-16 10:14:08 +10:00
Maxwell Gerber
6a16e7cd24
fix: Disconnecting should clear oauth state 2025-04-07 15:15:28 -07:00
Jerome
88984c7bc7
Linting 2025-02-23 15:15:28 +00:00
Jerome
19ee9fa86a
Merge remote-tracking branch 'origin/main' into justin/sdk-auth 2025-02-21 15:31:09 +00:00
Jerome
02479d3ea9
Updating imports 2025-02-21 15:03:14 +00:00
Jerome
c3ece186a4
Using urlencoded params for refresh/auth tokens 2025-02-21 14:51:47 +00:00
Justin Spahr-Summers
e9a50adde7
Update OAuth callback code 2025-02-11 17:42:49 +00:00
Justin Spahr-Summers
eb6af47b21
Refactor to use auth from SDK 2025-02-11 16:39:07 +00:00
Allen Zhou
1b13b574f8 Update auth.ts 2025-02-05 12:45:11 -08:00
Allen Zhou
95bbd60a38 Add zod parsing for OAuthMetadataSchema and OAuthTokensSchema 2025-02-05 12:42:09 -08:00
Allen Zhou
96ba6fd531 Convert OAuthMetadata and OAuthTokens to zod 2025-02-05 12:38:26 -08:00
Allen Zhou
8592cf2d07 Run prettier-fix 2025-02-05 11:22:11 -08:00
Allen Zhou
79547143a8 Add refresh token handling if returned from server 2025-02-03 19:53:53 -08:00
Justin Spahr-Summers
0882a3e0e5
Formatting 2025-01-24 15:23:24 +00:00
Justin Spahr-Summers
874320ebe6
Token exchange body needs to be JSON 2025-01-24 13:44:26 +00:00
Justin Spahr-Summers
02cfb47c83
Extract session storage keys into constants 2025-01-24 13:09:58 +00:00
Justin Spahr-Summers
16cb59670c
OAuth callback handler (not yet attached) 2025-01-24 11:37:35 +00:00
Justin Spahr-Summers
1c4ad60354
Redirect into OAuth flow upon receiving 401 2025-01-24 11:34:07 +00:00