@drmhse/sso-sdk 0.3.0 → 0.3.2
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/index.d.mts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +24 -0
- package/dist/index.mjs +24 -0
- package/package.json +14 -2
package/dist/index.d.mts
CHANGED
|
@@ -5378,6 +5378,10 @@ declare class SsoClient {
|
|
|
5378
5378
|
* Sets the JWT for all subsequent authenticated requests.
|
|
5379
5379
|
* Pass null to clear the token.
|
|
5380
5380
|
*
|
|
5381
|
+
* NOTE: For OAuth callback flows, prefer using setSession() which properly
|
|
5382
|
+
* updates the SessionManager. This method updates both the HTTP headers
|
|
5383
|
+
* AND the SessionManager for backward compatibility.
|
|
5384
|
+
*
|
|
5381
5385
|
* @param token The JWT string, or null to clear
|
|
5382
5386
|
*
|
|
5383
5387
|
* @example
|
|
@@ -5390,6 +5394,25 @@ declare class SsoClient {
|
|
|
5390
5394
|
* ```
|
|
5391
5395
|
*/
|
|
5392
5396
|
setAuthToken(token: string | null): void;
|
|
5397
|
+
/**
|
|
5398
|
+
* Sets the session tokens for OAuth callback flows.
|
|
5399
|
+
* This properly updates the SessionManager and persists tokens to storage.
|
|
5400
|
+
*
|
|
5401
|
+
* @param tokens Object containing access_token and optionally refresh_token
|
|
5402
|
+
*
|
|
5403
|
+
* @example
|
|
5404
|
+
* ```typescript
|
|
5405
|
+
* // After OAuth callback
|
|
5406
|
+
* await sso.setSession({
|
|
5407
|
+
* access_token: accessToken,
|
|
5408
|
+
* refresh_token: refreshToken
|
|
5409
|
+
* });
|
|
5410
|
+
* ```
|
|
5411
|
+
*/
|
|
5412
|
+
setSession(tokens: {
|
|
5413
|
+
access_token: string;
|
|
5414
|
+
refresh_token?: string;
|
|
5415
|
+
}): Promise<void>;
|
|
5393
5416
|
/**
|
|
5394
5417
|
* Sets the API key for service-to-service authentication.
|
|
5395
5418
|
* Pass null to clear the API key.
|
package/dist/index.d.ts
CHANGED
|
@@ -5378,6 +5378,10 @@ declare class SsoClient {
|
|
|
5378
5378
|
* Sets the JWT for all subsequent authenticated requests.
|
|
5379
5379
|
* Pass null to clear the token.
|
|
5380
5380
|
*
|
|
5381
|
+
* NOTE: For OAuth callback flows, prefer using setSession() which properly
|
|
5382
|
+
* updates the SessionManager. This method updates both the HTTP headers
|
|
5383
|
+
* AND the SessionManager for backward compatibility.
|
|
5384
|
+
*
|
|
5381
5385
|
* @param token The JWT string, or null to clear
|
|
5382
5386
|
*
|
|
5383
5387
|
* @example
|
|
@@ -5390,6 +5394,25 @@ declare class SsoClient {
|
|
|
5390
5394
|
* ```
|
|
5391
5395
|
*/
|
|
5392
5396
|
setAuthToken(token: string | null): void;
|
|
5397
|
+
/**
|
|
5398
|
+
* Sets the session tokens for OAuth callback flows.
|
|
5399
|
+
* This properly updates the SessionManager and persists tokens to storage.
|
|
5400
|
+
*
|
|
5401
|
+
* @param tokens Object containing access_token and optionally refresh_token
|
|
5402
|
+
*
|
|
5403
|
+
* @example
|
|
5404
|
+
* ```typescript
|
|
5405
|
+
* // After OAuth callback
|
|
5406
|
+
* await sso.setSession({
|
|
5407
|
+
* access_token: accessToken,
|
|
5408
|
+
* refresh_token: refreshToken
|
|
5409
|
+
* });
|
|
5410
|
+
* ```
|
|
5411
|
+
*/
|
|
5412
|
+
setSession(tokens: {
|
|
5413
|
+
access_token: string;
|
|
5414
|
+
refresh_token?: string;
|
|
5415
|
+
}): Promise<void>;
|
|
5393
5416
|
/**
|
|
5394
5417
|
* Sets the API key for service-to-service authentication.
|
|
5395
5418
|
* Pass null to clear the API key.
|
package/dist/index.js
CHANGED
|
@@ -4259,6 +4259,10 @@ var SsoClient = class {
|
|
|
4259
4259
|
* Sets the JWT for all subsequent authenticated requests.
|
|
4260
4260
|
* Pass null to clear the token.
|
|
4261
4261
|
*
|
|
4262
|
+
* NOTE: For OAuth callback flows, prefer using setSession() which properly
|
|
4263
|
+
* updates the SessionManager. This method updates both the HTTP headers
|
|
4264
|
+
* AND the SessionManager for backward compatibility.
|
|
4265
|
+
*
|
|
4262
4266
|
* @param token The JWT string, or null to clear
|
|
4263
4267
|
*
|
|
4264
4268
|
* @example
|
|
@@ -4273,10 +4277,30 @@ var SsoClient = class {
|
|
|
4273
4277
|
setAuthToken(token) {
|
|
4274
4278
|
if (token) {
|
|
4275
4279
|
this.http.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
|
4280
|
+
this.session.setSession({ access_token: token });
|
|
4276
4281
|
} else {
|
|
4277
4282
|
delete this.http.defaults.headers.common["Authorization"];
|
|
4283
|
+
this.session.clearSession();
|
|
4278
4284
|
}
|
|
4279
4285
|
}
|
|
4286
|
+
/**
|
|
4287
|
+
* Sets the session tokens for OAuth callback flows.
|
|
4288
|
+
* This properly updates the SessionManager and persists tokens to storage.
|
|
4289
|
+
*
|
|
4290
|
+
* @param tokens Object containing access_token and optionally refresh_token
|
|
4291
|
+
*
|
|
4292
|
+
* @example
|
|
4293
|
+
* ```typescript
|
|
4294
|
+
* // After OAuth callback
|
|
4295
|
+
* await sso.setSession({
|
|
4296
|
+
* access_token: accessToken,
|
|
4297
|
+
* refresh_token: refreshToken
|
|
4298
|
+
* });
|
|
4299
|
+
* ```
|
|
4300
|
+
*/
|
|
4301
|
+
async setSession(tokens) {
|
|
4302
|
+
await this.session.setSession(tokens);
|
|
4303
|
+
}
|
|
4280
4304
|
/**
|
|
4281
4305
|
* Sets the API key for service-to-service authentication.
|
|
4282
4306
|
* Pass null to clear the API key.
|
package/dist/index.mjs
CHANGED
|
@@ -4216,6 +4216,10 @@ var SsoClient = class {
|
|
|
4216
4216
|
* Sets the JWT for all subsequent authenticated requests.
|
|
4217
4217
|
* Pass null to clear the token.
|
|
4218
4218
|
*
|
|
4219
|
+
* NOTE: For OAuth callback flows, prefer using setSession() which properly
|
|
4220
|
+
* updates the SessionManager. This method updates both the HTTP headers
|
|
4221
|
+
* AND the SessionManager for backward compatibility.
|
|
4222
|
+
*
|
|
4219
4223
|
* @param token The JWT string, or null to clear
|
|
4220
4224
|
*
|
|
4221
4225
|
* @example
|
|
@@ -4230,10 +4234,30 @@ var SsoClient = class {
|
|
|
4230
4234
|
setAuthToken(token) {
|
|
4231
4235
|
if (token) {
|
|
4232
4236
|
this.http.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
|
4237
|
+
this.session.setSession({ access_token: token });
|
|
4233
4238
|
} else {
|
|
4234
4239
|
delete this.http.defaults.headers.common["Authorization"];
|
|
4240
|
+
this.session.clearSession();
|
|
4235
4241
|
}
|
|
4236
4242
|
}
|
|
4243
|
+
/**
|
|
4244
|
+
* Sets the session tokens for OAuth callback flows.
|
|
4245
|
+
* This properly updates the SessionManager and persists tokens to storage.
|
|
4246
|
+
*
|
|
4247
|
+
* @param tokens Object containing access_token and optionally refresh_token
|
|
4248
|
+
*
|
|
4249
|
+
* @example
|
|
4250
|
+
* ```typescript
|
|
4251
|
+
* // After OAuth callback
|
|
4252
|
+
* await sso.setSession({
|
|
4253
|
+
* access_token: accessToken,
|
|
4254
|
+
* refresh_token: refreshToken
|
|
4255
|
+
* });
|
|
4256
|
+
* ```
|
|
4257
|
+
*/
|
|
4258
|
+
async setSession(tokens) {
|
|
4259
|
+
await this.session.setSession(tokens);
|
|
4260
|
+
}
|
|
4237
4261
|
/**
|
|
4238
4262
|
* Sets the API key for service-to-service authentication.
|
|
4239
4263
|
* Pass null to clear the API key.
|
package/package.json
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drmhse/sso-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Zero-dependency TypeScript SDK for AuthOS, the multi-tenant authentication platform",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.mts",
|
|
12
|
+
"default": "./dist/index.mjs"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
8
20
|
"files": [
|
|
9
21
|
"dist"
|
|
10
22
|
],
|
|
@@ -48,4 +60,4 @@
|
|
|
48
60
|
"publishConfig": {
|
|
49
61
|
"access": "public"
|
|
50
62
|
}
|
|
51
|
-
}
|
|
63
|
+
}
|