@unoverse-platform/studio 0.1.99 → 0.1.100
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/package.json
CHANGED
|
@@ -166,8 +166,11 @@ async function verifyJWT(token: string): Promise<AuthUser | null> {
|
|
|
166
166
|
const { payload } = await jwtVerify(token, jwksSet, { issuer: issuers });
|
|
167
167
|
const expected = getAudience();
|
|
168
168
|
if (expected) {
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
// Both places are read, not the first one present: WorkOS sends its environment in `aud`
|
|
170
|
+
// and the signed-in app in `client_id`, and a cell names its own app.
|
|
171
|
+
const aud = payload.aud;
|
|
172
|
+
const clientId = (payload as Record<string, unknown>).client_id;
|
|
173
|
+
const values = [...(Array.isArray(aud) ? aud : aud ? [aud] : []), ...(clientId ? [clientId] : [])].map(String);
|
|
171
174
|
if (!values.includes(expected)) {
|
|
172
175
|
console.error(
|
|
173
176
|
`[auth] JWT validation failed: audience mismatch (expected ${expected}, token had ${values.join(", ") || "none"})`,
|