@base44-preview/sdk 0.8.53-pr.330.92cae72 → 0.8.53-pr.330.ac96a75
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.
|
@@ -7,8 +7,7 @@ export interface AiGatewayConnection {
|
|
|
7
7
|
/**
|
|
8
8
|
* Bearer token that authenticates the request: the service-role token from
|
|
9
9
|
* `base44.asServiceRole.aiGateway`, or the signed-in user's token from
|
|
10
|
-
* `base44.aiGateway`. The
|
|
11
|
-
* in, and the gateway rejects that call.
|
|
10
|
+
* `base44.aiGateway`. The gateway expects the service-role token.
|
|
12
11
|
*/
|
|
13
12
|
token: string;
|
|
14
13
|
/**
|
|
@@ -93,21 +92,20 @@ export interface AiGatewayModuleConfig {
|
|
|
93
92
|
*
|
|
94
93
|
* The mode determines which token `connection()` returns:
|
|
95
94
|
*
|
|
96
|
-
* - **
|
|
97
|
-
* - **
|
|
95
|
+
* - **Service role authentication** (`base44.asServiceRole.aiGateway`): Returns the app's service-role token.
|
|
96
|
+
* - **User authentication** (`base44.aiGateway`): Returns the signed-in app user's token. The gateway accepts it only on apps shared privately or with your workspace.
|
|
98
97
|
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* there's no signed-in user at all, such as from a scheduled automation.
|
|
98
|
+
* Call the gateway server-side with the app's service role, as every example
|
|
99
|
+
* here does. Calls from the browser or with a user's token are rejected with a
|
|
100
|
+
* `403`, the error code `ai_gateway_requires_service_role`, and the message
|
|
101
|
+
* "AI gateway requests must be made server-side using the app's service role.
|
|
102
|
+
* Calls from the browser or with a user's token are not allowed." Service role
|
|
103
|
+
* also works when there's no signed-in user at all, such as from a scheduled
|
|
104
|
+
* automation.
|
|
107
105
|
*
|
|
108
|
-
*
|
|
109
|
-
* `base44.auth.me()`
|
|
110
|
-
*
|
|
106
|
+
* In a backend function, for example, you can check the caller with
|
|
107
|
+
* `base44.auth.me()` before calling the gateway, and call the function from
|
|
108
|
+
* your page with `base44.functions.invoke()`.
|
|
111
109
|
*
|
|
112
110
|
* ## Billing and limits
|
|
113
111
|
*
|