@oauth-spa-kit/core 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tokenExchange.js +2 -0
- package/dist/types.d.ts +17 -0
- package/package.json +1 -1
package/dist/tokenExchange.js
CHANGED
|
@@ -60,6 +60,7 @@ export async function exchangeAuthorizationCode(args) {
|
|
|
60
60
|
code: args.code,
|
|
61
61
|
redirect_uri: args.config.redirectUri,
|
|
62
62
|
code_verifier: args.codeVerifier,
|
|
63
|
+
...(args.config.resource ? { resource: args.config.resource } : {}),
|
|
63
64
|
...assertionParams,
|
|
64
65
|
});
|
|
65
66
|
};
|
|
@@ -90,6 +91,7 @@ export async function exchangeRefreshToken(args) {
|
|
|
90
91
|
grant_type: "refresh_token",
|
|
91
92
|
client_id: args.config.clientId,
|
|
92
93
|
refresh_token: args.refreshToken,
|
|
94
|
+
...(args.config.resource ? { resource: args.config.resource } : {}),
|
|
93
95
|
...assertionParams,
|
|
94
96
|
});
|
|
95
97
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -57,6 +57,23 @@ export interface OAuthClientConfig {
|
|
|
57
57
|
*/
|
|
58
58
|
par?: boolean;
|
|
59
59
|
extraAuthorizationParams?: Record<string, string>;
|
|
60
|
+
/**
|
|
61
|
+
* RFC 8707 resource indicator -- which protected-resource audience this client wants on its
|
|
62
|
+
* access token. Automatically included on every leg that mints or renews a token: the
|
|
63
|
+
* authorize/PAR request (`createLoginHandler`) *and* every token-endpoint call
|
|
64
|
+
* (`exchangeAuthorizationCode`, `exchangeRefreshToken`) -- set this once here rather than
|
|
65
|
+
* duplicating it into `extraAuthorizationParams` yourself. Some authorization servers scope a
|
|
66
|
+
* resource's inclusion in `aud` to an explicit indicator on the *current* token request (RFC
|
|
67
|
+
* 8707 section 2 permits this; IdentityServer's own `RequireResourceIndicator` is one
|
|
68
|
+
* well-known example of an AS that does) and silently drop that resource from the minted
|
|
69
|
+
* token otherwise, even though it was already validated at authorize time -- the
|
|
70
|
+
* authorization code/refresh token only carries forward what was *granted*, not what gets
|
|
71
|
+
* *reissued* on every subsequent token call. Confirmed against a real independently-built AS
|
|
72
|
+
* with this exact behavior. Single-valued:
|
|
73
|
+
* a consumer needing more than one simultaneous audience should request them as separate
|
|
74
|
+
* tokens.
|
|
75
|
+
*/
|
|
76
|
+
resource?: string;
|
|
60
77
|
}
|
|
61
78
|
/** Raw token endpoint response (RFC 6749 section 5.1). */
|
|
62
79
|
export interface TokenResponse {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oauth-spa-kit/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Framework- and runtime-agnostic OAuth 2.1 / OIDC primitives (PKCE, discovery, token exchange, DPoP) plus a fetch-based session client. Runs in the browser, Node, and edge runtimes -- no DOM or Node-only APIs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|