@tthr/vue 0.0.23 → 0.0.24

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.
@@ -247,24 +247,29 @@ export default defineEventHandler(async (event) => {
247
247
  const authHeader = getHeader(event, 'authorization');
248
248
  const strandsToken = getHeader(event, 'x-strands-token');
249
249
 
250
- // If using Strands auth, try to validate the token
250
+ // If using Strands auth, validate the token via Tether server
251
251
  if (strandsToken || authHeader?.startsWith('Bearer ')) {
252
252
  const token = strandsToken || authHeader?.replace('Bearer ', '');
253
253
  if (token) {
254
254
  try {
255
- // Try to fetch user identity from Strands auth service
256
- const authResponse = await fetch('https://accounts.strands.gg/api/auth/me', {
257
- headers: { 'Authorization': `Bearer ${token}` },
255
+ // Validate token via Tether server (which checks if Strands Auth is enabled)
256
+ const authResponse = await fetch(`${url}/api/v1/projects/${projectId}/auth/validate`, {
257
+ method: 'POST',
258
+ headers: { 'Content-Type': 'application/json' },
259
+ body: JSON.stringify({ accessToken: token }),
258
260
  });
259
261
  if (authResponse.ok) {
260
- const userData = await authResponse.json();
261
- userIdentity = {
262
- subject: userData.id || userData.sub,
263
- email: userData.email,
264
- ...userData,
265
- };
262
+ const authData = await authResponse.json();
263
+ if (authData.valid) {
264
+ userIdentity = {
265
+ subject: authData.userId,
266
+ email: authData.email,
267
+ name: authData.name,
268
+ };
269
+ }
266
270
  }
267
- } catch {
271
+ } catch (authError) {
272
+ console.warn('[Tether] Auth validation failed:', authError.message);
268
273
  // Auth validation failed - continue without identity
269
274
  }
270
275
  }
@@ -255,24 +255,29 @@ export default defineEventHandler(async (event) => {
255
255
  const authHeader = getHeader(event, 'authorization');
256
256
  const strandsToken = getHeader(event, 'x-strands-token');
257
257
 
258
- // If using Strands auth, try to validate the token
258
+ // If using Strands auth, validate the token via Tether server
259
259
  if (strandsToken || authHeader?.startsWith('Bearer ')) {
260
260
  const token = strandsToken || authHeader?.replace('Bearer ', '');
261
261
  if (token) {
262
262
  try {
263
- // Try to fetch user identity from Strands auth service
264
- const authResponse = await fetch('https://accounts.strands.gg/api/auth/me', {
265
- headers: { 'Authorization': `Bearer ${token}` },
263
+ // Validate token via Tether server (which checks if Strands Auth is enabled)
264
+ const authResponse = await fetch(`${url}/api/v1/projects/${projectId}/auth/validate`, {
265
+ method: 'POST',
266
+ headers: { 'Content-Type': 'application/json' },
267
+ body: JSON.stringify({ accessToken: token }),
266
268
  });
267
269
  if (authResponse.ok) {
268
- const userData = await authResponse.json();
269
- userIdentity = {
270
- subject: userData.id || userData.sub,
271
- email: userData.email,
272
- ...userData,
273
- };
270
+ const authData = await authResponse.json();
271
+ if (authData.valid) {
272
+ userIdentity = {
273
+ subject: authData.userId,
274
+ email: authData.email,
275
+ name: authData.name,
276
+ };
277
+ }
274
278
  }
275
- } catch {
279
+ } catch (authError) {
280
+ console.warn('[Tether] Auth validation failed:', authError.message);
276
281
  // Auth validation failed - continue without identity
277
282
  }
278
283
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tthr/vue",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "description": "Tether Vue/Nuxt SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -22,11 +22,6 @@
22
22
  "dist",
23
23
  "nuxt"
24
24
  ],
25
- "scripts": {
26
- "build": "tsc",
27
- "dev": "tsc --watch",
28
- "typecheck": "tsc --noEmit"
29
- },
30
25
  "dependencies": {
31
26
  "@nuxt/kit": "^3.14.0",
32
27
  "@tthr/client": "latest",
@@ -37,5 +32,10 @@
37
32
  },
38
33
  "peerDependencies": {
39
34
  "vue": "^3.0.0"
35
+ },
36
+ "scripts": {
37
+ "build": "tsc",
38
+ "dev": "tsc --watch",
39
+ "typecheck": "tsc --noEmit"
40
40
  }
41
- }
41
+ }