@faable/auth-sdk 2.9.11 → 2.9.13

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/README.md CHANGED
@@ -17,12 +17,12 @@ Programmatically manage FaableAuth users, teams, connections and clients through
17
17
  > SDK itself has no Node-only dependencies and bundles for the browser. What
18
18
  > you must never ship to a browser or any untrusted runtime is a
19
19
  > **`client_secret`** or an **API key** — those grant management scopes over
20
- > the whole tenant. A user's own bearer token or the browser's session cookie
20
+ > the tenant. A user's own bearer token or the browser's session cookie
21
21
  > only grant what that user can do, and those are fine client-side.
22
22
 
23
23
  | Strategy | Credential | Grants | Where |
24
24
  | ----------------------- | --------------------------------- | ------------------------------------------------------------------ | --------------------------------------- |
25
- | `authClientCredentials` | `client_id` + **`client_secret`** | The management scopes of the client (full catalog unless narrowed) | **Server only** |
25
+ | `authClientCredentials` | `client_id` + **`client_secret`** | The client's Management API scopes (its allow-list; none by default) | **Server only** |
26
26
  | `authApikey` | **API key** (`fak_…`) | The management scopes of the key | **Server only** |
27
27
  | `authBearer` | A token the caller already holds | Whatever that token's scopes and subject allow | Anywhere the token itself may live |
28
28
  | `authCookie` | The browser's session cookie | The signed-in user's own session (`/me`, MFA, passkeys…) | Browser, same-origin with the auth host |
@@ -66,6 +66,16 @@ const api = FaableAuthApi.create({
66
66
  });
67
67
  ```
68
68
 
69
+ **Allow the client its Management API scopes first.** The token carries at most
70
+ the client's allow-list (`management_scopes`): with no `scope` in `auth`, the
71
+ whole list; with `scope`, the requested ones that are on it. A new client's list
72
+ is empty, so until you allow scopes (dashboard → your Auth tenant → Clients →
73
+ the client → OAuth → **Management API scopes**) every call fails with a
74
+ `FaableApiError` whose message names `management_scopes_empty` and says where to
75
+ fix it; asking only for scopes outside the list names
76
+ `management_scope_not_allowed`. See
77
+ [Calling the Faable Management API](https://faable.com/docs/auth/oauth-flows/client-credentials#management-api-scopes).
78
+
69
79
  By default the token is requested from `<domain>/oauth/token`. If your API host
70
80
  is **not** the auth server, override it with `auth.domain`:
71
81
 
@@ -1038,6 +1038,7 @@ export declare class FaableAuthApi extends GeneratedFaableAuthApi {
1038
1038
  } | undefined;
1039
1039
  login_flow?: string | null | undefined;
1040
1040
  default_audience?: string | null | undefined;
1041
+ management_scopes?: string[] | undefined;
1041
1042
  saml_sp?: {
1042
1043
  enabled: boolean;
1043
1044
  entity_id: string;
@@ -1122,6 +1123,7 @@ export declare class FaableAuthApi extends GeneratedFaableAuthApi {
1122
1123
  } | undefined;
1123
1124
  login_flow?: string | null | undefined;
1124
1125
  default_audience?: string | null | undefined;
1126
+ management_scopes?: string[] | undefined;
1125
1127
  saml_sp?: {
1126
1128
  enabled: boolean;
1127
1129
  entity_id: string;
@@ -1209,6 +1211,7 @@ export declare class FaableAuthApi extends GeneratedFaableAuthApi {
1209
1211
  } | undefined;
1210
1212
  login_flow?: string | null | undefined;
1211
1213
  default_audience?: string | null | undefined;
1214
+ management_scopes?: string[] | undefined;
1212
1215
  saml_sp?: {
1213
1216
  enabled: boolean;
1214
1217
  entity_id: string;
@@ -1295,6 +1298,7 @@ export declare class FaableAuthApi extends GeneratedFaableAuthApi {
1295
1298
  } | undefined;
1296
1299
  login_flow?: string | null | undefined;
1297
1300
  default_audience?: string | null | undefined;
1301
+ management_scopes?: string[] | undefined;
1298
1302
  saml_sp?: {
1299
1303
  enabled: boolean;
1300
1304
  entity_id: string;
@@ -3,13 +3,16 @@ import { FaableApiError } from "@faable/sdk-base";
3
3
  import { GeneratedFaableAuthApi } from "./api/generated-client.js";
4
4
  import { authClientCredentials } from "@faable/sdk-base";
5
5
  import { SDK_CLIENT } from "./version.js";
6
+ import { withManagementTokenErrors } from "./management_errors.js";
6
7
  // auth-sdk exists to drive the Faable management API, so a client_credentials
7
8
  // client should "just work" against it from `domain` alone. The management API
8
9
  // audience is `faable:management:<account_id>`, where `<account_id>` is this
9
10
  // host's tenant. We discover it from the public OIDC discovery document (which
10
11
  // resolves the account by host and exposes its id as `account`) lazily on the
11
- // first token request, and memoize it. Omitting `scope` then yields the full
12
- // management catalog server-side (Auth0 parity), so no scope wiring is needed.
12
+ // first token request, and memoize it. Omitting `scope` then yields the
13
+ // client's own Management API allow-list (`management_scopes`) server-side —
14
+ // not the whole catalog, and nothing at all while that list is empty; the two
15
+ // refusals get an actionable message (management_errors.ts).
13
16
  //
14
17
  // The memo is module-level, keyed by host. It used to be a closure created per
15
18
  // constructor, so it only ever helped an instance that outlived several token
@@ -86,6 +89,12 @@ export class FaableAuthApi extends GeneratedFaableAuthApi {
86
89
  baseURL,
87
90
  ...params,
88
91
  auth,
92
+ // Same strategy, with the Management API allow-list refusals of the
93
+ // token endpoint explained (management_errors.ts). Only for
94
+ // client_credentials: other strategies never call /oauth/token.
95
+ ...(usesClientCredentials && {
96
+ authStrategy: withManagementTokenErrors(params.authStrategy ?? authClientCredentials),
97
+ }),
89
98
  // Identify ourselves as a first-party client (`x-faable-client:
90
99
  // auth-sdk/<version>+<sha>`, surfaced as the `client`/`client_version`/
91
100
  // `client_sha` tags), and forward any consumer-supplied `name`/`instance`
@@ -1576,6 +1576,7 @@ export declare abstract class GeneratedFaableAuthApi extends FaableApi {
1576
1576
  } | undefined;
1577
1577
  login_flow?: string | null | undefined;
1578
1578
  default_audience?: string | null | undefined;
1579
+ management_scopes?: string[] | undefined;
1579
1580
  saml_sp?: {
1580
1581
  enabled: boolean;
1581
1582
  entity_id: string;
@@ -1676,6 +1677,7 @@ export declare abstract class GeneratedFaableAuthApi extends FaableApi {
1676
1677
  } | undefined;
1677
1678
  login_flow?: string | null | undefined;
1678
1679
  default_audience?: string | null | undefined;
1680
+ management_scopes?: string[] | undefined;
1679
1681
  saml_sp?: {
1680
1682
  enabled: boolean;
1681
1683
  entity_id: string;
@@ -1777,6 +1779,7 @@ export declare abstract class GeneratedFaableAuthApi extends FaableApi {
1777
1779
  } | undefined;
1778
1780
  login_flow?: string | null | undefined;
1779
1781
  default_audience?: string | null | undefined;
1782
+ management_scopes?: string[] | undefined;
1780
1783
  saml_sp?: {
1781
1784
  enabled: boolean;
1782
1785
  entity_id: string;
@@ -1879,6 +1882,7 @@ export declare abstract class GeneratedFaableAuthApi extends FaableApi {
1879
1882
  } | undefined;
1880
1883
  login_flow?: string | null | undefined;
1881
1884
  default_audience?: string | null | undefined;
1885
+ management_scopes?: string[] | undefined;
1882
1886
  saml_sp?: {
1883
1887
  enabled: boolean;
1884
1888
  entity_id: string;
@@ -1963,6 +1967,7 @@ export declare abstract class GeneratedFaableAuthApi extends FaableApi {
1963
1967
  } | undefined;
1964
1968
  login_flow?: string | null | undefined;
1965
1969
  default_audience?: string | null | undefined;
1970
+ management_scopes?: string[] | undefined;
1966
1971
  saml_sp?: {
1967
1972
  enabled: boolean;
1968
1973
  entity_id: string;
@@ -2050,6 +2055,7 @@ export declare abstract class GeneratedFaableAuthApi extends FaableApi {
2050
2055
  } | undefined;
2051
2056
  login_flow?: string | null | undefined;
2052
2057
  default_audience?: string | null | undefined;
2058
+ management_scopes?: string[] | undefined;
2053
2059
  saml_sp?: {
2054
2060
  enabled: boolean;
2055
2061
  entity_id: string;
@@ -2153,6 +2159,7 @@ export declare abstract class GeneratedFaableAuthApi extends FaableApi {
2153
2159
  } | undefined;
2154
2160
  login_flow?: string | null | undefined;
2155
2161
  default_audience?: string | null | undefined;
2162
+ management_scopes?: string[] | undefined;
2156
2163
  saml_sp?: {
2157
2164
  enabled: boolean;
2158
2165
  entity_id: string;
@@ -2254,6 +2261,7 @@ export declare abstract class GeneratedFaableAuthApi extends FaableApi {
2254
2261
  } | undefined;
2255
2262
  login_flow?: string | null | undefined;
2256
2263
  default_audience?: string | null | undefined;
2264
+ management_scopes?: string[] | undefined;
2257
2265
  saml_sp?: {
2258
2266
  enabled: boolean;
2259
2267
  entity_id: string;
@@ -6237,6 +6237,8 @@ export interface components {
6237
6237
  login_flow?: string | null;
6238
6238
  /** @description Audience used when a client_credentials token request sends none (e.g. `faable:management:<account_id>`). An explicit `audience` in the request wins. Absent = `${iss}/userinfo`. */
6239
6239
  default_audience?: string | null;
6240
+ /** @description Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens. */
6241
+ management_scopes?: string[];
6240
6242
  saml_sp?: {
6241
6243
  /** @description Whether this client answers SAML requests. Off keeps the configuration but every /saml route of the client returns 404. */
6242
6244
  enabled: boolean;
@@ -6286,6 +6288,8 @@ export interface components {
6286
6288
  web_origins?: string[];
6287
6289
  initiate_login_uri?: string;
6288
6290
  grant_types?: ("authorization_code" | "client_credentials" | "refresh_token" | "password" | "http://auth0.com/oauth/grant-type/passwordless/otp" | "urn:ietf:params:oauth:grant-type:token-exchange" | "urn:ietf:params:oauth:grant-type:device_code" | "http://auth0.com/oauth/grant-type/mfa-otp" | "http://auth0.com/oauth/grant-type/mfa-recovery-code")[];
6291
+ /** @description Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens. Only scopes your own token holds can be granted. */
6292
+ management_scopes?: string[];
6289
6293
  /** @description Add Metadata */
6290
6294
  metadata?: {
6291
6295
  [key: string]: unknown;
@@ -6391,6 +6395,8 @@ export interface components {
6391
6395
  login_flow?: string | null;
6392
6396
  /** @description Audience a client_credentials token request gets when it sends none. An explicit `audience` wins. `null` removes it. */
6393
6397
  default_audience?: string | null;
6398
+ /** @description Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens. Replaces the whole list; `[]` removes all. Only scopes your own token holds can be added. */
6399
+ management_scopes?: string[];
6394
6400
  saml_sp?: {
6395
6401
  /** @description Whether this client answers SAML requests. Off keeps the configuration but every /saml route of the client returns 404. */
6396
6402
  enabled: boolean;
@@ -13012,6 +13018,8 @@ export interface operations {
13012
13018
  web_origins?: string[];
13013
13019
  initiate_login_uri?: string;
13014
13020
  grant_types?: ("authorization_code" | "client_credentials" | "refresh_token" | "password" | "http://auth0.com/oauth/grant-type/passwordless/otp" | "urn:ietf:params:oauth:grant-type:token-exchange" | "urn:ietf:params:oauth:grant-type:device_code" | "http://auth0.com/oauth/grant-type/mfa-otp" | "http://auth0.com/oauth/grant-type/mfa-recovery-code")[];
13021
+ /** @description Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens. Only scopes your own token holds can be granted. */
13022
+ management_scopes?: string[];
13015
13023
  /** @description Add Metadata */
13016
13024
  metadata?: {
13017
13025
  [key: string]: unknown;
@@ -13127,6 +13135,8 @@ export interface operations {
13127
13135
  login_flow?: string | null;
13128
13136
  /** @description Audience used when a client_credentials token request sends none (e.g. `faable:management:<account_id>`). An explicit `audience` in the request wins. Absent = `${iss}/userinfo`. */
13129
13137
  default_audience?: string | null;
13138
+ /** @description Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens. */
13139
+ management_scopes?: string[];
13130
13140
  saml_sp?: {
13131
13141
  /** @description Whether this client answers SAML requests. Off keeps the configuration but every /saml route of the client returns 404. */
13132
13142
  enabled: boolean;
@@ -13364,6 +13374,8 @@ export interface operations {
13364
13374
  login_flow?: string | null;
13365
13375
  /** @description Audience used when a client_credentials token request sends none (e.g. `faable:management:<account_id>`). An explicit `audience` in the request wins. Absent = `${iss}/userinfo`. */
13366
13376
  default_audience?: string | null;
13377
+ /** @description Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens. */
13378
+ management_scopes?: string[];
13367
13379
  saml_sp?: {
13368
13380
  /** @description Whether this client answers SAML requests. Off keeps the configuration but every /saml route of the client returns 404. */
13369
13381
  enabled: boolean;
@@ -13594,6 +13606,8 @@ export interface operations {
13594
13606
  login_flow?: string | null;
13595
13607
  /** @description Audience a client_credentials token request gets when it sends none. An explicit `audience` wins. `null` removes it. */
13596
13608
  default_audience?: string | null;
13609
+ /** @description Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens. Replaces the whole list; `[]` removes all. Only scopes your own token holds can be added. */
13610
+ management_scopes?: string[];
13597
13611
  saml_sp?: {
13598
13612
  /** @description Whether this client answers SAML requests. Off keeps the configuration but every /saml route of the client returns 404. */
13599
13613
  enabled: boolean;
@@ -13728,6 +13742,8 @@ export interface operations {
13728
13742
  login_flow?: string | null;
13729
13743
  /** @description Audience used when a client_credentials token request sends none (e.g. `faable:management:<account_id>`). An explicit `audience` in the request wins. Absent = `${iss}/userinfo`. */
13730
13744
  default_audience?: string | null;
13745
+ /** @description Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens. */
13746
+ management_scopes?: string[];
13731
13747
  saml_sp?: {
13732
13748
  /** @description Whether this client answers SAML requests. Off keeps the configuration but every /saml route of the client returns 404. */
13733
13749
  enabled: boolean;
@@ -13971,6 +13987,8 @@ export interface operations {
13971
13987
  login_flow?: string | null;
13972
13988
  /** @description Audience used when a client_credentials token request sends none (e.g. `faable:management:<account_id>`). An explicit `audience` in the request wins. Absent = `${iss}/userinfo`. */
13973
13989
  default_audience?: string | null;
13990
+ /** @description Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens. */
13991
+ management_scopes?: string[];
13974
13992
  saml_sp?: {
13975
13993
  /** @description Whether this client answers SAML requests. Off keeps the configuration but every /saml route of the client returns 404. */
13976
13994
  enabled: boolean;
@@ -14212,6 +14230,8 @@ export interface operations {
14212
14230
  login_flow?: string | null;
14213
14231
  /** @description Audience used when a client_credentials token request sends none (e.g. `faable:management:<account_id>`). An explicit `audience` in the request wins. Absent = `${iss}/userinfo`. */
14214
14232
  default_audience?: string | null;
14233
+ /** @description Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens. */
14234
+ management_scopes?: string[];
14215
14235
  saml_sp?: {
14216
14236
  /** @description Whether this client answers SAML requests. Off keeps the configuration but every /saml route of the client returns 404. */
14217
14237
  enabled: boolean;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./FaableAuthApi.js";
2
2
  export { SDK_CLIENT, commit, version } from "./version.js";
3
+ export { MANAGEMENT_SCOPES_DOCS } from "./management_errors.js";
3
4
  export * from "./api/generated-client.js";
4
5
  export * from "./api/api-types.js";
5
6
  export * from "./api/types.js";
package/dist/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  export * from "./FaableAuthApi.js";
2
2
  export { SDK_CLIENT, commit, version } from "./version.js";
3
+ // The Management API allow-list refusals of the token endpoint, explained.
4
+ export { MANAGEMENT_SCOPES_DOCS } from "./management_errors.js";
3
5
  export * from "./api/generated-client.js";
4
6
  export * from "./api/api-types.js";
5
7
  export * from "./api/types.js";
@@ -0,0 +1,17 @@
1
+ import { FaableApiError } from "@faable/sdk-base";
2
+ import type { AuthStrategyBuilder } from "@faable/sdk-base";
3
+ export declare const MANAGEMENT_SCOPES_DOCS = "https://faable.com/docs/auth/oauth-flows/client-credentials#management-api-scopes";
4
+ /**
5
+ * The same error with an actionable message when it is one of the two
6
+ * allow-list refusals of the token endpoint; `undefined` otherwise.
7
+ */
8
+ export declare const managementTokenError: (err: unknown, client_id?: string, scope?: string | string[]) => FaableApiError | undefined;
9
+ /**
10
+ * Wraps a client_credentials strategy so a refused Management API token
11
+ * surfaces as {@link managementTokenError}. Every other outcome — tokens,
12
+ * other errors, the 401 renewal — is the wrapped strategy's own.
13
+ */
14
+ export declare const withManagementTokenErrors: <TConfig extends {
15
+ client_id?: string | undefined;
16
+ scope?: string | string[] | undefined;
17
+ }>(builder: AuthStrategyBuilder<TConfig>) => AuthStrategyBuilder<TConfig>;
@@ -0,0 +1,68 @@
1
+ import { FaableApiError } from "@faable/sdk-base";
2
+ // The Management API token a client_credentials client obtains is bounded by
3
+ // the client's own allow-list (`Client.management_scopes`, auth ≥ the release
4
+ // that introduced it): a request with no `scope` — what this SDK sends by
5
+ // default — gets the whole list, and an EMPTY list is refused. The token
6
+ // endpoint answers with RFC 6749 errors, whose body has no `message`, so the
7
+ // sdk-base error would read "ERR_BAD_REQUEST (status=403, …)". These two
8
+ // codes get a sentence that says what to change and where. Nothing else is
9
+ // touched: the original response stays on the error (`error_code`, `status`).
10
+ export const MANAGEMENT_SCOPES_DOCS = "https://faable.com/docs/auth/oauth-flows/client-credentials#management-api-scopes";
11
+ const WHERE = "In the Faable dashboard open your Auth tenant → Clients → this client → OAuth → " +
12
+ "Management API scopes";
13
+ const explain = (code, client_id, scope) => {
14
+ const client = client_id ? `client ${client_id}` : "this client";
15
+ if (code === "management_scopes_empty") {
16
+ return (`FaableAuthApi: auth refused a Management API token to ${client} because ` +
17
+ "it is not allowed any Management API scopes (management_scopes_empty). " +
18
+ `${WHERE} and allow the scopes this backend uses (e.g. read:users), or send ` +
19
+ `\`management_scopes\` on POST /client/:id. See ${MANAGEMENT_SCOPES_DOCS}`);
20
+ }
21
+ if (code === "management_scope_not_allowed") {
22
+ return (`FaableAuthApi: none of the requested scopes${scope ? ` (${scope})` : ""} ` +
23
+ `is in the Management API scopes of ${client} (management_scope_not_allowed). ` +
24
+ `Request scopes that are on its list, or ${WHERE.charAt(0).toLowerCase()}${WHERE.slice(1)} ` +
25
+ `and add them. See ${MANAGEMENT_SCOPES_DOCS}`);
26
+ }
27
+ return undefined;
28
+ };
29
+ /**
30
+ * The same error with an actionable message when it is one of the two
31
+ * allow-list refusals of the token endpoint; `undefined` otherwise.
32
+ */
33
+ export const managementTokenError = (err, client_id, scope) => {
34
+ if (!(err instanceof FaableApiError))
35
+ return undefined;
36
+ const message = explain(err.error_code, client_id, Array.isArray(scope) ? scope.join(" ") : scope);
37
+ if (!message)
38
+ return undefined;
39
+ // The response is kept so `error_code`, `isErrorCode()` and `isStatus()`
40
+ // answer as before; only the sentence changes.
41
+ const explained = new FaableApiError(message, err.response);
42
+ // FaableApiError prefers the body's `message` over the one passed in; this
43
+ // sentence is the point, so it wins.
44
+ const status = err.response?.status;
45
+ explained.message = status ? `${message} (status=${status})` : message;
46
+ explained.code = err.code;
47
+ explained.cause = err;
48
+ return explained;
49
+ };
50
+ /**
51
+ * Wraps a client_credentials strategy so a refused Management API token
52
+ * surfaces as {@link managementTokenError}. Every other outcome — tokens,
53
+ * other errors, the 401 renewal — is the wrapped strategy's own.
54
+ */
55
+ export const withManagementTokenErrors = (builder) => (config, context) => {
56
+ const strategy = builder(config, context);
57
+ return {
58
+ ...strategy,
59
+ headers: async () => {
60
+ try {
61
+ return await strategy.headers();
62
+ }
63
+ catch (err) {
64
+ throw (managementTokenError(err, config?.client_id, config?.scope) ?? err);
65
+ }
66
+ },
67
+ };
68
+ };
package/dist/version.js CHANGED
@@ -9,13 +9,13 @@
9
9
  // login pages could not import the SDK at all. Same pattern as auth-js.
10
10
  //
11
11
  // The sentinels MUST stay byte-identical to the `from` values in `.releaserc`.
12
- export const version = "2.9.11";
12
+ export const version = "2.9.13";
13
13
  // Short git SHA of the released commit. The version dates a build; this names
14
14
  // the exact tree, so a canonical log line or an audit entry leads straight to
15
15
  // `git show <sha>`. Deliberately NOT hex: an unreleased build (dev, a local
16
16
  // link) cannot be mistaken for a real commit — auth only records values that
17
17
  // look like a SHA, and this one never will.
18
- export const commit = "57570b7";
18
+ export const commit = "e26f6c9";
19
19
  // What this SDK writes in `x-faable-client`. Exported for a consumer that
20
20
  // builds a strategy on its own (outside `FaableAuthApi`) and still wants the
21
21
  // token request attributed — a bare `authClientCredentials` stamps only what
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faable/auth-sdk",
3
- "version": "2.9.11",
3
+ "version": "2.9.13",
4
4
  "author": "Marc Pomar <marc@faable.com>",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/spec/openapi.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "info": {
4
4
  "title": "@faablecloud/auth",
5
5
  "description": "Auth Platform made by Faable. Manage Users and Roles",
6
- "version": "2.99.1",
6
+ "version": "2.99.2",
7
7
  "license": {
8
8
  "name": "private",
9
9
  "url": "https://faable.com/docs/platform/privacy-policy"
@@ -2128,6 +2128,13 @@
2128
2128
  "description": "Audience used when a client_credentials token request sends none (e.g. `faable:management:<account_id>`). An explicit `audience` in the request wins. Absent = `${iss}/userinfo`.",
2129
2129
  "nullable": true
2130
2130
  },
2131
+ "management_scopes": {
2132
+ "type": "array",
2133
+ "items": {
2134
+ "type": "string"
2135
+ },
2136
+ "description": "Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens."
2137
+ },
2131
2138
  "saml_sp": {
2132
2139
  "type": "object",
2133
2140
  "required": [
@@ -2355,6 +2362,14 @@
2355
2362
  },
2356
2363
  "uniqueItems": true
2357
2364
  },
2365
+ "management_scopes": {
2366
+ "type": "array",
2367
+ "items": {
2368
+ "type": "string"
2369
+ },
2370
+ "uniqueItems": true,
2371
+ "description": "Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens. Only scopes your own token holds can be granted."
2372
+ },
2358
2373
  "metadata": {
2359
2374
  "type": "object",
2360
2375
  "properties": {},
@@ -2983,6 +2998,14 @@
2983
2998
  "description": "Audience a client_credentials token request gets when it sends none. An explicit `audience` wins. `null` removes it.",
2984
2999
  "nullable": true
2985
3000
  },
3001
+ "management_scopes": {
3002
+ "type": "array",
3003
+ "items": {
3004
+ "type": "string"
3005
+ },
3006
+ "uniqueItems": true,
3007
+ "description": "Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens. Replaces the whole list; `[]` removes all. Only scopes your own token holds can be added."
3008
+ },
2986
3009
  "saml_sp": {
2987
3010
  "anyOf": [
2988
3011
  {
@@ -21033,6 +21056,14 @@
21033
21056
  },
21034
21057
  "uniqueItems": true
21035
21058
  },
21059
+ "management_scopes": {
21060
+ "type": "array",
21061
+ "items": {
21062
+ "type": "string"
21063
+ },
21064
+ "uniqueItems": true,
21065
+ "description": "Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens. Only scopes your own token holds can be granted."
21066
+ },
21036
21067
  "metadata": {
21037
21068
  "type": "object",
21038
21069
  "properties": {},
@@ -21561,6 +21592,13 @@
21561
21592
  "description": "Audience used when a client_credentials token request sends none (e.g. `faable:management:<account_id>`). An explicit `audience` in the request wins. Absent = `${iss}/userinfo`.",
21562
21593
  "nullable": true
21563
21594
  },
21595
+ "management_scopes": {
21596
+ "type": "array",
21597
+ "items": {
21598
+ "type": "string"
21599
+ },
21600
+ "description": "Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens."
21601
+ },
21564
21602
  "saml_sp": {
21565
21603
  "type": "object",
21566
21604
  "required": [
@@ -22376,6 +22414,13 @@
22376
22414
  "description": "Audience used when a client_credentials token request sends none (e.g. `faable:management:<account_id>`). An explicit `audience` in the request wins. Absent = `${iss}/userinfo`.",
22377
22415
  "nullable": true
22378
22416
  },
22417
+ "management_scopes": {
22418
+ "type": "array",
22419
+ "items": {
22420
+ "type": "string"
22421
+ },
22422
+ "description": "Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens."
22423
+ },
22379
22424
  "saml_sp": {
22380
22425
  "type": "object",
22381
22426
  "required": [
@@ -23224,6 +23269,14 @@
23224
23269
  "description": "Audience a client_credentials token request gets when it sends none. An explicit `audience` wins. `null` removes it.",
23225
23270
  "nullable": true
23226
23271
  },
23272
+ "management_scopes": {
23273
+ "type": "array",
23274
+ "items": {
23275
+ "type": "string"
23276
+ },
23277
+ "uniqueItems": true,
23278
+ "description": "Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens. Replaces the whole list; `[]` removes all. Only scopes your own token holds can be added."
23279
+ },
23227
23280
  "saml_sp": {
23228
23281
  "anyOf": [
23229
23282
  {
@@ -23870,6 +23923,13 @@
23870
23923
  "description": "Audience used when a client_credentials token request sends none (e.g. `faable:management:<account_id>`). An explicit `audience` in the request wins. Absent = `${iss}/userinfo`.",
23871
23924
  "nullable": true
23872
23925
  },
23926
+ "management_scopes": {
23927
+ "type": "array",
23928
+ "items": {
23929
+ "type": "string"
23930
+ },
23931
+ "description": "Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens."
23932
+ },
23873
23933
  "saml_sp": {
23874
23934
  "type": "object",
23875
23935
  "required": [
@@ -24685,6 +24745,13 @@
24685
24745
  "description": "Audience used when a client_credentials token request sends none (e.g. `faable:management:<account_id>`). An explicit `audience` in the request wins. Absent = `${iss}/userinfo`.",
24686
24746
  "nullable": true
24687
24747
  },
24748
+ "management_scopes": {
24749
+ "type": "array",
24750
+ "items": {
24751
+ "type": "string"
24752
+ },
24753
+ "description": "Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens."
24754
+ },
24688
24755
  "saml_sp": {
24689
24756
  "type": "object",
24690
24757
  "required": [
@@ -25501,6 +25568,13 @@
25501
25568
  "description": "Audience used when a client_credentials token request sends none (e.g. `faable:management:<account_id>`). An explicit `audience` in the request wins. Absent = `${iss}/userinfo`.",
25502
25569
  "nullable": true
25503
25570
  },
25571
+ "management_scopes": {
25572
+ "type": "array",
25573
+ "items": {
25574
+ "type": "string"
25575
+ },
25576
+ "description": "Management API scopes (e.g. `read:rolemembers`) this client may obtain with client_credentials for the audience `faable:management:<account_id>`. A token request gets the requested scopes that are in this list, or the whole list when it asks for none. Empty = the client cannot obtain Management API tokens."
25577
+ },
25504
25578
  "saml_sp": {
25505
25579
  "type": "object",
25506
25580
  "required": [