@treeviz/familysearch-sdk 1.0.25 → 2.0.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/README.md +499 -30
- package/dist/auth/index.cjs +102 -0
- package/dist/auth/index.d.cts +1 -124
- package/dist/auth/index.d.ts +1 -124
- package/dist/auth/index.js +102 -1
- package/dist/index-B8IEIPI-.d.cts +5558 -0
- package/dist/index-D-O_e-PM.d.cts +359 -0
- package/dist/index-D-O_e-PM.d.ts +359 -0
- package/dist/index-D1LjJwtP.d.ts +5558 -0
- package/dist/index-DbUKUKnB.d.cts +171 -0
- package/dist/index-Ko_Hpn8j.d.ts +171 -0
- package/dist/index.cjs +5910 -822
- package/dist/index.d.cts +158 -5
- package/dist/index.d.ts +158 -5
- package/dist/index.js +5878 -818
- package/dist/places/index.cjs +303 -80
- package/dist/places/index.d.cts +3 -69
- package/dist/places/index.d.ts +3 -69
- package/dist/places/index.js +290 -78
- package/dist/tree/index.cjs +3412 -170
- package/dist/tree/index.d.cts +3 -50
- package/dist/tree/index.d.ts +3 -50
- package/dist/tree/index.js +3266 -167
- package/dist/tree-Bs2PWco8.d.cts +1335 -0
- package/dist/tree-Bs2PWco8.d.ts +1335 -0
- package/dist/utils/index.cjs +14 -9
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +14 -9
- package/package.json +7 -3
- package/dist/client-CoN1l8gT.d.ts +0 -276
- package/dist/client-yKRhqQzH.d.cts +0 -276
- package/dist/index-DqPXkWyy.d.cts +0 -671
- package/dist/index-DqPXkWyy.d.ts +0 -671
package/dist/auth/index.cjs
CHANGED
|
@@ -289,9 +289,111 @@ function clearAllTokens() {
|
|
|
289
289
|
localStorage.removeItem(key);
|
|
290
290
|
});
|
|
291
291
|
}
|
|
292
|
+
var OAuthAPI = class {
|
|
293
|
+
constructor(config) {
|
|
294
|
+
this.config = config;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Get OAuth endpoints for current environment
|
|
298
|
+
*/
|
|
299
|
+
getEndpoints() {
|
|
300
|
+
return getOAuthEndpoints(this.config.environment);
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Generate a cryptographically secure random state
|
|
304
|
+
*/
|
|
305
|
+
generateState() {
|
|
306
|
+
return generateOAuthState();
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Build authorization URL
|
|
310
|
+
*/
|
|
311
|
+
buildAuthorizationUrl(state, options) {
|
|
312
|
+
return buildAuthorizationUrl(this.config, state, options);
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Exchange authorization code for access token
|
|
316
|
+
*/
|
|
317
|
+
async exchangeCodeForToken(code) {
|
|
318
|
+
return exchangeCodeForToken(code, this.config);
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Refresh an access token
|
|
322
|
+
*/
|
|
323
|
+
async refreshAccessToken(refreshToken) {
|
|
324
|
+
return refreshAccessToken(refreshToken, this.config);
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Validate an access token
|
|
328
|
+
*/
|
|
329
|
+
async validateAccessToken(accessToken) {
|
|
330
|
+
return validateAccessToken(accessToken, this.config.environment);
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Get user info from access token
|
|
334
|
+
*/
|
|
335
|
+
async getUserInfo(accessToken) {
|
|
336
|
+
return getUserInfo(accessToken, this.config.environment);
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Store OAuth state in localStorage
|
|
340
|
+
*/
|
|
341
|
+
storeState(state, options) {
|
|
342
|
+
return storeOAuthState(state, options);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Validate OAuth state from callback
|
|
346
|
+
*/
|
|
347
|
+
validateState(state) {
|
|
348
|
+
return validateOAuthState(state);
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Open OAuth authorization in popup
|
|
352
|
+
*/
|
|
353
|
+
openPopup(authUrl, options) {
|
|
354
|
+
return openOAuthPopup(authUrl, options);
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Parse OAuth callback parameters from URL
|
|
358
|
+
*/
|
|
359
|
+
parseCallbackParams(url) {
|
|
360
|
+
return parseCallbackParams(url);
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Store tokens for a user
|
|
364
|
+
*/
|
|
365
|
+
storeTokens(userId, tokens) {
|
|
366
|
+
return storeTokens(userId, tokens);
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Get stored access token for a user
|
|
370
|
+
*/
|
|
371
|
+
getStoredAccessToken(userId) {
|
|
372
|
+
return getStoredAccessToken(userId);
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Get stored refresh token for a user
|
|
376
|
+
*/
|
|
377
|
+
getStoredRefreshToken(userId) {
|
|
378
|
+
return getStoredRefreshToken(userId);
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Clear all stored tokens for a user
|
|
382
|
+
*/
|
|
383
|
+
clearStoredTokens(userId) {
|
|
384
|
+
return clearStoredTokens(userId);
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Clear all FamilySearch tokens from storage
|
|
388
|
+
*/
|
|
389
|
+
clearAllTokens() {
|
|
390
|
+
return clearAllTokens();
|
|
391
|
+
}
|
|
392
|
+
};
|
|
292
393
|
|
|
293
394
|
exports.OAUTH_ENDPOINTS = OAUTH_ENDPOINTS;
|
|
294
395
|
exports.OAUTH_STORAGE_KEYS = OAUTH_STORAGE_KEYS;
|
|
396
|
+
exports.OAuthAPI = OAuthAPI;
|
|
295
397
|
exports.buildAuthorizationUrl = buildAuthorizationUrl;
|
|
296
398
|
exports.clearAllTokens = clearAllTokens;
|
|
297
399
|
exports.clearStoredTokens = clearStoredTokens;
|
package/dist/auth/index.d.cts
CHANGED
|
@@ -1,124 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* FamilySearch OAuth Authentication Module
|
|
5
|
-
*
|
|
6
|
-
* Provides OAuth 2.0 authentication utilities for FamilySearch API v3.
|
|
7
|
-
* This module is designed to be framework-agnostic and can be used
|
|
8
|
-
* in any JavaScript/TypeScript environment.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
declare const OAUTH_ENDPOINTS: Record<FamilySearchEnvironment, OAuthEndpoints>;
|
|
12
|
-
/**
|
|
13
|
-
* Get OAuth endpoints for a specific environment
|
|
14
|
-
*/
|
|
15
|
-
declare function getOAuthEndpoints(environment?: FamilySearchEnvironment): OAuthEndpoints;
|
|
16
|
-
/**
|
|
17
|
-
* Generate a cryptographically secure random state for CSRF protection
|
|
18
|
-
*/
|
|
19
|
-
declare function generateOAuthState(): string;
|
|
20
|
-
/**
|
|
21
|
-
* Build the authorization URL for OAuth flow
|
|
22
|
-
*/
|
|
23
|
-
declare function buildAuthorizationUrl(config: OAuthConfig, state: string, options?: {
|
|
24
|
-
scopes?: string[];
|
|
25
|
-
prompt?: string;
|
|
26
|
-
}): string;
|
|
27
|
-
/**
|
|
28
|
-
* Exchange authorization code for access token
|
|
29
|
-
*/
|
|
30
|
-
declare function exchangeCodeForToken(code: string, config: OAuthConfig): Promise<OAuthTokenResponse>;
|
|
31
|
-
/**
|
|
32
|
-
* Refresh an access token using a refresh token
|
|
33
|
-
*/
|
|
34
|
-
declare function refreshAccessToken(refreshToken: string, config: OAuthConfig): Promise<OAuthTokenResponse>;
|
|
35
|
-
/**
|
|
36
|
-
* Validate an access token by making a test API call
|
|
37
|
-
*/
|
|
38
|
-
declare function validateAccessToken(accessToken: string, environment?: FamilySearchEnvironment): Promise<boolean>;
|
|
39
|
-
/**
|
|
40
|
-
* Get user info from access token
|
|
41
|
-
*/
|
|
42
|
-
declare function getUserInfo(accessToken: string, environment?: FamilySearchEnvironment): Promise<{
|
|
43
|
-
sub: string;
|
|
44
|
-
name?: string;
|
|
45
|
-
given_name?: string;
|
|
46
|
-
family_name?: string;
|
|
47
|
-
email?: string;
|
|
48
|
-
email_verified?: boolean;
|
|
49
|
-
} | null>;
|
|
50
|
-
/**
|
|
51
|
-
* Storage keys for OAuth state management
|
|
52
|
-
*/
|
|
53
|
-
declare const OAUTH_STORAGE_KEYS: {
|
|
54
|
-
readonly state: "fs_oauth_state";
|
|
55
|
-
readonly linkMode: "fs_oauth_link_mode";
|
|
56
|
-
readonly lang: "fs_oauth_lang";
|
|
57
|
-
readonly parentUid: "fs_oauth_parent_uid";
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Store OAuth state in localStorage for popup flow
|
|
61
|
-
* Uses localStorage instead of sessionStorage because popup windows
|
|
62
|
-
* don't share sessionStorage with the parent window
|
|
63
|
-
*/
|
|
64
|
-
declare function storeOAuthState(state: string, options?: {
|
|
65
|
-
isLinkMode?: boolean;
|
|
66
|
-
lang?: string;
|
|
67
|
-
parentUid?: string;
|
|
68
|
-
}): void;
|
|
69
|
-
/**
|
|
70
|
-
* Validate OAuth state from callback and extract metadata
|
|
71
|
-
* Returns invalid state if localStorage is not available (SSR/Node.js environments)
|
|
72
|
-
*/
|
|
73
|
-
declare function validateOAuthState(state: string): OAuthStateValidation;
|
|
74
|
-
/**
|
|
75
|
-
* Open OAuth authorization in a popup window
|
|
76
|
-
*/
|
|
77
|
-
declare function openOAuthPopup(authUrl: string, options?: {
|
|
78
|
-
width?: number;
|
|
79
|
-
height?: number;
|
|
80
|
-
windowName?: string;
|
|
81
|
-
}): Window | null;
|
|
82
|
-
/**
|
|
83
|
-
* Parse OAuth callback parameters from URL
|
|
84
|
-
*/
|
|
85
|
-
declare function parseCallbackParams(url?: string): {
|
|
86
|
-
code?: string;
|
|
87
|
-
state?: string;
|
|
88
|
-
error?: string;
|
|
89
|
-
error_description?: string;
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Generate a storage key scoped to a user ID
|
|
93
|
-
*/
|
|
94
|
-
declare function getTokenStorageKey(userId: string, type: "access" | "expires" | "refresh" | "environment"): string;
|
|
95
|
-
/**
|
|
96
|
-
* Store access token with expiration
|
|
97
|
-
* Per FamilySearch compatibility requirements:
|
|
98
|
-
* - Access tokens stored in sessionStorage (cleared on browser close)
|
|
99
|
-
* - Refresh tokens stored in localStorage (for re-authentication)
|
|
100
|
-
*/
|
|
101
|
-
declare function storeTokens(userId: string, tokens: {
|
|
102
|
-
accessToken: string;
|
|
103
|
-
expiresAt?: number;
|
|
104
|
-
refreshToken?: string;
|
|
105
|
-
environment?: string;
|
|
106
|
-
}): void;
|
|
107
|
-
/**
|
|
108
|
-
* Get stored access token
|
|
109
|
-
*/
|
|
110
|
-
declare function getStoredAccessToken(userId: string): string | null;
|
|
111
|
-
/**
|
|
112
|
-
* Get stored refresh token
|
|
113
|
-
*/
|
|
114
|
-
declare function getStoredRefreshToken(userId: string): string | null;
|
|
115
|
-
/**
|
|
116
|
-
* Clear all stored tokens for a user
|
|
117
|
-
*/
|
|
118
|
-
declare function clearStoredTokens(userId: string): void;
|
|
119
|
-
/**
|
|
120
|
-
* Clear all FamilySearch tokens from storage
|
|
121
|
-
*/
|
|
122
|
-
declare function clearAllTokens(): void;
|
|
123
|
-
|
|
124
|
-
export { OAUTH_ENDPOINTS, OAUTH_STORAGE_KEYS, buildAuthorizationUrl, clearAllTokens, clearStoredTokens, exchangeCodeForToken, generateOAuthState, getOAuthEndpoints, getStoredAccessToken, getStoredRefreshToken, getTokenStorageKey, getUserInfo, openOAuthPopup, parseCallbackParams, refreshAccessToken, storeOAuthState, storeTokens, validateAccessToken, validateOAuthState };
|
|
1
|
+
export { y as OAUTH_ENDPOINTS, l as OAUTH_STORAGE_KEYS, z as OAuthAPI, i as buildAuthorizationUrl, x as clearAllTokens, w as clearStoredTokens, j as exchangeCodeForToken, h as generateOAuthState, g as getOAuthEndpoints, t as getStoredAccessToken, u as getStoredRefreshToken, n as getTokenStorageKey, k as getUserInfo, o as openOAuthPopup, p as parseCallbackParams, r as refreshAccessToken, s as storeOAuthState, q as storeTokens, v as validateAccessToken, m as validateOAuthState } from '../index-D-O_e-PM.cjs';
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,124 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* FamilySearch OAuth Authentication Module
|
|
5
|
-
*
|
|
6
|
-
* Provides OAuth 2.0 authentication utilities for FamilySearch API v3.
|
|
7
|
-
* This module is designed to be framework-agnostic and can be used
|
|
8
|
-
* in any JavaScript/TypeScript environment.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
declare const OAUTH_ENDPOINTS: Record<FamilySearchEnvironment, OAuthEndpoints>;
|
|
12
|
-
/**
|
|
13
|
-
* Get OAuth endpoints for a specific environment
|
|
14
|
-
*/
|
|
15
|
-
declare function getOAuthEndpoints(environment?: FamilySearchEnvironment): OAuthEndpoints;
|
|
16
|
-
/**
|
|
17
|
-
* Generate a cryptographically secure random state for CSRF protection
|
|
18
|
-
*/
|
|
19
|
-
declare function generateOAuthState(): string;
|
|
20
|
-
/**
|
|
21
|
-
* Build the authorization URL for OAuth flow
|
|
22
|
-
*/
|
|
23
|
-
declare function buildAuthorizationUrl(config: OAuthConfig, state: string, options?: {
|
|
24
|
-
scopes?: string[];
|
|
25
|
-
prompt?: string;
|
|
26
|
-
}): string;
|
|
27
|
-
/**
|
|
28
|
-
* Exchange authorization code for access token
|
|
29
|
-
*/
|
|
30
|
-
declare function exchangeCodeForToken(code: string, config: OAuthConfig): Promise<OAuthTokenResponse>;
|
|
31
|
-
/**
|
|
32
|
-
* Refresh an access token using a refresh token
|
|
33
|
-
*/
|
|
34
|
-
declare function refreshAccessToken(refreshToken: string, config: OAuthConfig): Promise<OAuthTokenResponse>;
|
|
35
|
-
/**
|
|
36
|
-
* Validate an access token by making a test API call
|
|
37
|
-
*/
|
|
38
|
-
declare function validateAccessToken(accessToken: string, environment?: FamilySearchEnvironment): Promise<boolean>;
|
|
39
|
-
/**
|
|
40
|
-
* Get user info from access token
|
|
41
|
-
*/
|
|
42
|
-
declare function getUserInfo(accessToken: string, environment?: FamilySearchEnvironment): Promise<{
|
|
43
|
-
sub: string;
|
|
44
|
-
name?: string;
|
|
45
|
-
given_name?: string;
|
|
46
|
-
family_name?: string;
|
|
47
|
-
email?: string;
|
|
48
|
-
email_verified?: boolean;
|
|
49
|
-
} | null>;
|
|
50
|
-
/**
|
|
51
|
-
* Storage keys for OAuth state management
|
|
52
|
-
*/
|
|
53
|
-
declare const OAUTH_STORAGE_KEYS: {
|
|
54
|
-
readonly state: "fs_oauth_state";
|
|
55
|
-
readonly linkMode: "fs_oauth_link_mode";
|
|
56
|
-
readonly lang: "fs_oauth_lang";
|
|
57
|
-
readonly parentUid: "fs_oauth_parent_uid";
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Store OAuth state in localStorage for popup flow
|
|
61
|
-
* Uses localStorage instead of sessionStorage because popup windows
|
|
62
|
-
* don't share sessionStorage with the parent window
|
|
63
|
-
*/
|
|
64
|
-
declare function storeOAuthState(state: string, options?: {
|
|
65
|
-
isLinkMode?: boolean;
|
|
66
|
-
lang?: string;
|
|
67
|
-
parentUid?: string;
|
|
68
|
-
}): void;
|
|
69
|
-
/**
|
|
70
|
-
* Validate OAuth state from callback and extract metadata
|
|
71
|
-
* Returns invalid state if localStorage is not available (SSR/Node.js environments)
|
|
72
|
-
*/
|
|
73
|
-
declare function validateOAuthState(state: string): OAuthStateValidation;
|
|
74
|
-
/**
|
|
75
|
-
* Open OAuth authorization in a popup window
|
|
76
|
-
*/
|
|
77
|
-
declare function openOAuthPopup(authUrl: string, options?: {
|
|
78
|
-
width?: number;
|
|
79
|
-
height?: number;
|
|
80
|
-
windowName?: string;
|
|
81
|
-
}): Window | null;
|
|
82
|
-
/**
|
|
83
|
-
* Parse OAuth callback parameters from URL
|
|
84
|
-
*/
|
|
85
|
-
declare function parseCallbackParams(url?: string): {
|
|
86
|
-
code?: string;
|
|
87
|
-
state?: string;
|
|
88
|
-
error?: string;
|
|
89
|
-
error_description?: string;
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Generate a storage key scoped to a user ID
|
|
93
|
-
*/
|
|
94
|
-
declare function getTokenStorageKey(userId: string, type: "access" | "expires" | "refresh" | "environment"): string;
|
|
95
|
-
/**
|
|
96
|
-
* Store access token with expiration
|
|
97
|
-
* Per FamilySearch compatibility requirements:
|
|
98
|
-
* - Access tokens stored in sessionStorage (cleared on browser close)
|
|
99
|
-
* - Refresh tokens stored in localStorage (for re-authentication)
|
|
100
|
-
*/
|
|
101
|
-
declare function storeTokens(userId: string, tokens: {
|
|
102
|
-
accessToken: string;
|
|
103
|
-
expiresAt?: number;
|
|
104
|
-
refreshToken?: string;
|
|
105
|
-
environment?: string;
|
|
106
|
-
}): void;
|
|
107
|
-
/**
|
|
108
|
-
* Get stored access token
|
|
109
|
-
*/
|
|
110
|
-
declare function getStoredAccessToken(userId: string): string | null;
|
|
111
|
-
/**
|
|
112
|
-
* Get stored refresh token
|
|
113
|
-
*/
|
|
114
|
-
declare function getStoredRefreshToken(userId: string): string | null;
|
|
115
|
-
/**
|
|
116
|
-
* Clear all stored tokens for a user
|
|
117
|
-
*/
|
|
118
|
-
declare function clearStoredTokens(userId: string): void;
|
|
119
|
-
/**
|
|
120
|
-
* Clear all FamilySearch tokens from storage
|
|
121
|
-
*/
|
|
122
|
-
declare function clearAllTokens(): void;
|
|
123
|
-
|
|
124
|
-
export { OAUTH_ENDPOINTS, OAUTH_STORAGE_KEYS, buildAuthorizationUrl, clearAllTokens, clearStoredTokens, exchangeCodeForToken, generateOAuthState, getOAuthEndpoints, getStoredAccessToken, getStoredRefreshToken, getTokenStorageKey, getUserInfo, openOAuthPopup, parseCallbackParams, refreshAccessToken, storeOAuthState, storeTokens, validateAccessToken, validateOAuthState };
|
|
1
|
+
export { y as OAUTH_ENDPOINTS, l as OAUTH_STORAGE_KEYS, z as OAuthAPI, i as buildAuthorizationUrl, x as clearAllTokens, w as clearStoredTokens, j as exchangeCodeForToken, h as generateOAuthState, g as getOAuthEndpoints, t as getStoredAccessToken, u as getStoredRefreshToken, n as getTokenStorageKey, k as getUserInfo, o as openOAuthPopup, p as parseCallbackParams, r as refreshAccessToken, s as storeOAuthState, q as storeTokens, v as validateAccessToken, m as validateOAuthState } from '../index-D-O_e-PM.js';
|
package/dist/auth/index.js
CHANGED
|
@@ -287,5 +287,106 @@ function clearAllTokens() {
|
|
|
287
287
|
localStorage.removeItem(key);
|
|
288
288
|
});
|
|
289
289
|
}
|
|
290
|
+
var OAuthAPI = class {
|
|
291
|
+
constructor(config) {
|
|
292
|
+
this.config = config;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Get OAuth endpoints for current environment
|
|
296
|
+
*/
|
|
297
|
+
getEndpoints() {
|
|
298
|
+
return getOAuthEndpoints(this.config.environment);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Generate a cryptographically secure random state
|
|
302
|
+
*/
|
|
303
|
+
generateState() {
|
|
304
|
+
return generateOAuthState();
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Build authorization URL
|
|
308
|
+
*/
|
|
309
|
+
buildAuthorizationUrl(state, options) {
|
|
310
|
+
return buildAuthorizationUrl(this.config, state, options);
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Exchange authorization code for access token
|
|
314
|
+
*/
|
|
315
|
+
async exchangeCodeForToken(code) {
|
|
316
|
+
return exchangeCodeForToken(code, this.config);
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Refresh an access token
|
|
320
|
+
*/
|
|
321
|
+
async refreshAccessToken(refreshToken) {
|
|
322
|
+
return refreshAccessToken(refreshToken, this.config);
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Validate an access token
|
|
326
|
+
*/
|
|
327
|
+
async validateAccessToken(accessToken) {
|
|
328
|
+
return validateAccessToken(accessToken, this.config.environment);
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Get user info from access token
|
|
332
|
+
*/
|
|
333
|
+
async getUserInfo(accessToken) {
|
|
334
|
+
return getUserInfo(accessToken, this.config.environment);
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Store OAuth state in localStorage
|
|
338
|
+
*/
|
|
339
|
+
storeState(state, options) {
|
|
340
|
+
return storeOAuthState(state, options);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Validate OAuth state from callback
|
|
344
|
+
*/
|
|
345
|
+
validateState(state) {
|
|
346
|
+
return validateOAuthState(state);
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Open OAuth authorization in popup
|
|
350
|
+
*/
|
|
351
|
+
openPopup(authUrl, options) {
|
|
352
|
+
return openOAuthPopup(authUrl, options);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Parse OAuth callback parameters from URL
|
|
356
|
+
*/
|
|
357
|
+
parseCallbackParams(url) {
|
|
358
|
+
return parseCallbackParams(url);
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Store tokens for a user
|
|
362
|
+
*/
|
|
363
|
+
storeTokens(userId, tokens) {
|
|
364
|
+
return storeTokens(userId, tokens);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Get stored access token for a user
|
|
368
|
+
*/
|
|
369
|
+
getStoredAccessToken(userId) {
|
|
370
|
+
return getStoredAccessToken(userId);
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Get stored refresh token for a user
|
|
374
|
+
*/
|
|
375
|
+
getStoredRefreshToken(userId) {
|
|
376
|
+
return getStoredRefreshToken(userId);
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Clear all stored tokens for a user
|
|
380
|
+
*/
|
|
381
|
+
clearStoredTokens(userId) {
|
|
382
|
+
return clearStoredTokens(userId);
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Clear all FamilySearch tokens from storage
|
|
386
|
+
*/
|
|
387
|
+
clearAllTokens() {
|
|
388
|
+
return clearAllTokens();
|
|
389
|
+
}
|
|
390
|
+
};
|
|
290
391
|
|
|
291
|
-
export { OAUTH_ENDPOINTS, OAUTH_STORAGE_KEYS, buildAuthorizationUrl, clearAllTokens, clearStoredTokens, exchangeCodeForToken, generateOAuthState, getOAuthEndpoints, getStoredAccessToken, getStoredRefreshToken, getTokenStorageKey, getUserInfo, openOAuthPopup, parseCallbackParams, refreshAccessToken, storeOAuthState, storeTokens, validateAccessToken, validateOAuthState };
|
|
392
|
+
export { OAUTH_ENDPOINTS, OAUTH_STORAGE_KEYS, OAuthAPI, buildAuthorizationUrl, clearAllTokens, clearStoredTokens, exchangeCodeForToken, generateOAuthState, getOAuthEndpoints, getStoredAccessToken, getStoredRefreshToken, getTokenStorageKey, getUserInfo, openOAuthPopup, parseCallbackParams, refreshAccessToken, storeOAuthState, storeTokens, validateAccessToken, validateOAuthState };
|