@qaecy/cue-sdk 0.0.26 → 0.0.27
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 +31 -0
- package/{cue-BjbRXItA.js → cue-CzxsQ6aP.js} +284 -238
- package/index.d.ts +2 -0
- package/index.js +17 -16
- package/lib/api.d.ts +3 -0
- package/lib/auth.d.ts +2 -0
- package/lib/extraction.d.ts +48 -0
- package/node.js +19 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -94,6 +94,37 @@ Sign in using a Cue API key. Intended for non-interactive/server-side use (e.g.
|
|
|
94
94
|
const user = await cue.auth.signInWithApiKey('MY_CUE_API_KEY', 'my-project-id');
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
+
### `cue.auth.signInWithCustomToken(token)`
|
|
98
|
+
|
|
99
|
+
Sign in using a Firebase custom token. Intended for server-issued auth flows such as MCP tools or OAuth-protected backends where the server mints a token on behalf of the user.
|
|
100
|
+
|
|
101
|
+
**Typical flow (e.g. MCP + Google OAuth):**
|
|
102
|
+
|
|
103
|
+
1. The server receives a Google OAuth access token (e.g. via the MCP host's OAuth dance).
|
|
104
|
+
2. The server looks up the Firebase UID for the Google `sub` claim and mints a custom token using Firebase Admin:
|
|
105
|
+
```typescript
|
|
106
|
+
// Server side (Node.js / Firebase Admin)
|
|
107
|
+
import * as admin from 'firebase-admin';
|
|
108
|
+
|
|
109
|
+
async function mintCustomToken(googleAccessToken: string): Promise<string> {
|
|
110
|
+
const res = await fetch('https://www.googleapis.com/oauth2/v3/userinfo', {
|
|
111
|
+
headers: { Authorization: `Bearer ${googleAccessToken}` },
|
|
112
|
+
});
|
|
113
|
+
const { sub } = await res.json(); // Google UID
|
|
114
|
+
|
|
115
|
+
const user = await admin.auth().getUserByProviderUid('google.com', sub);
|
|
116
|
+
return admin.auth().createCustomToken(user.uid);
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
3. The custom token is passed to the browser/view (e.g. via `structuredContent`).
|
|
120
|
+
4. The client signs in instantly — no popup, no redirect, no polling:
|
|
121
|
+
```typescript
|
|
122
|
+
// Browser / view side
|
|
123
|
+
const cue = new Cue();
|
|
124
|
+
await cue.auth.signInWithCustomToken(customToken);
|
|
125
|
+
// cue is now fully authenticated
|
|
126
|
+
```
|
|
127
|
+
|
|
97
128
|
### `cue.auth.signOut()`
|
|
98
129
|
|
|
99
130
|
```typescript
|