@yusufstar07/sdk-client 1.1.0 → 1.1.1
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/dist/client.d.ts +3 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +9 -21
- package/package.json +2 -2
package/dist/client.d.ts
CHANGED
|
@@ -42,8 +42,10 @@ export declare class SDKClient {
|
|
|
42
42
|
logout(accessToken?: string): Promise<LogoutResponse>;
|
|
43
43
|
/**
|
|
44
44
|
* Get current user
|
|
45
|
+
* Token is automatically sent via cookies (httpOnly)
|
|
46
|
+
* Backend reads token from cookie, no Authorization header needed
|
|
45
47
|
*/
|
|
46
|
-
me(
|
|
48
|
+
me(): Promise<MeResponse>;
|
|
47
49
|
/**
|
|
48
50
|
* Get access token (for manual token management)
|
|
49
51
|
*/
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,eAAe,EACf,cAAc,EACd,UAAU,EAEb,MAAM,SAAS,CAAC;AAEjB,qBAAa,SAAS;IAClB,OAAO,CAAC,MAAM,CAKZ;IACF,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,cAAc,CAAyC;gBAEnD,MAAM,EAAE,eAAe;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,eAAe,EACf,cAAc,EACd,UAAU,EAEb,MAAM,SAAS,CAAC;AAEjB,qBAAa,SAAS;IAClB,OAAO,CAAC,MAAM,CAKZ;IACF,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,cAAc,CAAyC;gBAEnD,MAAM,EAAE,eAAe;IAuFnC;;OAEG;YACW,oBAAoB;IAkBlC;;OAEG;YACW,cAAc;IAwC5B;;OAEG;IACH,OAAO,CAAC,cAAc;IAgBtB;;OAEG;IACH,OAAO,CAAC,eAAe;IAevB;;OAEG;IACH,OAAO,CAAC,WAAW;IASnB;;OAEG;IACG,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAchE;;OAEG;IACG,KAAK,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAkBvD;;OAEG;IACG,OAAO,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAwC9D;;OAEG;IACG,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAwC3D;;;;OAIG;IACG,EAAE,IAAI,OAAO,CAAC,UAAU,CAAC;IAgB/B;;OAEG;IACH,QAAQ,IAAI,MAAM,GAAG,IAAI;IAIzB;;OAEG;IACH,eAAe,IAAI,OAAO;CAG7B;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,CAElE"}
|
package/dist/client.js
CHANGED
|
@@ -23,18 +23,13 @@ export class SDKClient {
|
|
|
23
23
|
},
|
|
24
24
|
withCredentials: true, // Include cookies automatically
|
|
25
25
|
});
|
|
26
|
-
// Add request interceptor for API key
|
|
26
|
+
// Add request interceptor for API key only
|
|
27
|
+
// Cookies (including auth tokens) are automatically sent via withCredentials: true
|
|
27
28
|
this.axiosInstance.interceptors.request.use((config) => {
|
|
28
29
|
// Always add API key
|
|
29
30
|
if (config.headers) {
|
|
30
31
|
config.headers["x-api-key"] = this.config.apiKey;
|
|
31
|
-
//
|
|
32
|
-
if (!config.headers["Authorization"]) {
|
|
33
|
-
const accessToken = this.getAccessToken();
|
|
34
|
-
if (accessToken) {
|
|
35
|
-
config.headers["Authorization"] = `Bearer ${accessToken}`;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
32
|
+
// Do NOT add Authorization header - backend will read token from cookie
|
|
38
33
|
}
|
|
39
34
|
return config;
|
|
40
35
|
}, (error) => {
|
|
@@ -279,21 +274,14 @@ export class SDKClient {
|
|
|
279
274
|
}
|
|
280
275
|
/**
|
|
281
276
|
* Get current user
|
|
277
|
+
* Token is automatically sent via cookies (httpOnly)
|
|
278
|
+
* Backend reads token from cookie, no Authorization header needed
|
|
282
279
|
*/
|
|
283
|
-
async me(
|
|
284
|
-
const token = accessToken || this.getAccessToken();
|
|
285
|
-
if (!token) {
|
|
286
|
-
throw {
|
|
287
|
-
error: "Access token is required",
|
|
288
|
-
status: 401,
|
|
289
|
-
};
|
|
290
|
-
}
|
|
280
|
+
async me() {
|
|
291
281
|
try {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
},
|
|
296
|
-
});
|
|
282
|
+
// No Authorization header - axios sends cookies automatically via withCredentials: true
|
|
283
|
+
// Backend reads token from cookie
|
|
284
|
+
const response = await this.axiosInstance.get("/api/sdk/me");
|
|
297
285
|
return response.data;
|
|
298
286
|
}
|
|
299
287
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yusufstar07/sdk-client",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "SDK client for Multi-Auth Platform authentication",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -38,4 +38,4 @@
|
|
|
38
38
|
"optional": true
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
}
|