@forgerock/oidc-client 1.2.0 → 1.3.0
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 +22 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +8 -1
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/authorize.request.d.ts +18 -0
- package/dist/src/lib/authorize.request.d.ts.map +1 -0
- package/dist/src/lib/authorize.request.js +125 -0
- package/dist/src/lib/authorize.request.js.map +1 -0
- package/dist/src/lib/authorize.request.types.d.ts +50 -0
- package/dist/src/lib/authorize.request.types.d.ts.map +1 -0
- package/dist/src/lib/authorize.request.types.js +2 -0
- package/dist/src/lib/authorize.request.types.js.map +1 -0
- package/dist/src/lib/authorize.request.utils.d.ts +35 -0
- package/dist/src/lib/authorize.request.utils.d.ts.map +1 -0
- package/dist/src/lib/authorize.request.utils.js +101 -0
- package/dist/src/lib/authorize.request.utils.js.map +1 -0
- package/dist/src/lib/authorize.slice.d.ts +5 -0
- package/dist/src/lib/authorize.slice.d.ts.map +1 -0
- package/dist/src/lib/authorize.slice.js +27 -0
- package/dist/src/lib/authorize.slice.js.map +1 -0
- package/dist/src/lib/client.store.d.ts +115 -0
- package/dist/src/lib/client.store.d.ts.map +1 -0
- package/dist/src/lib/client.store.js +433 -0
- package/dist/src/lib/client.store.js.map +1 -0
- package/dist/src/lib/client.store.utils.d.ts +104 -0
- package/dist/src/lib/client.store.utils.d.ts.map +1 -0
- package/dist/src/lib/client.store.utils.js +92 -0
- package/dist/src/lib/client.store.utils.js.map +1 -0
- package/dist/src/lib/client.types.d.ts +35 -0
- package/dist/src/lib/client.types.d.ts.map +1 -0
- package/dist/src/lib/client.types.js +2 -0
- package/dist/src/lib/client.types.js.map +1 -0
- package/dist/src/lib/config.types.d.ts +22 -0
- package/dist/src/lib/config.types.d.ts.map +1 -0
- package/dist/src/lib/config.types.js +2 -0
- package/dist/src/lib/config.types.js.map +1 -0
- package/dist/src/lib/exchange.request.d.ts +18 -0
- package/dist/src/lib/exchange.request.d.ts.map +1 -0
- package/dist/src/lib/exchange.request.js +22 -0
- package/dist/src/lib/exchange.request.js.map +1 -0
- package/dist/src/lib/exchange.types.d.ts +21 -0
- package/dist/src/lib/exchange.types.d.ts.map +1 -0
- package/dist/src/lib/exchange.types.js +2 -0
- package/dist/src/lib/exchange.types.js.map +1 -0
- package/dist/src/lib/exchange.utils.d.ts +28 -0
- package/dist/src/lib/exchange.utils.d.ts.map +1 -0
- package/dist/src/lib/exchange.utils.js +55 -0
- package/dist/src/lib/exchange.utils.js.map +1 -0
- package/dist/src/lib/logout.request.d.ts +13 -0
- package/dist/src/lib/logout.request.d.ts.map +1 -0
- package/dist/src/lib/logout.request.js +47 -0
- package/dist/src/lib/logout.request.js.map +1 -0
- package/dist/src/lib/oidc.api.d.ts +33 -0
- package/dist/src/lib/oidc.api.d.ts.map +1 -0
- package/dist/src/lib/oidc.api.js +295 -0
- package/dist/src/lib/oidc.api.js.map +1 -0
- package/dist/src/lib/oidc.api.utils.d.ts +3 -0
- package/dist/src/lib/oidc.api.utils.d.ts.map +1 -0
- package/dist/src/lib/oidc.api.utils.js +9 -0
- package/dist/src/lib/oidc.api.utils.js.map +1 -0
- package/dist/src/lib/token.utils.d.ts +2 -0
- package/dist/src/lib/token.utils.d.ts.map +1 -0
- package/dist/src/lib/token.utils.js +15 -0
- package/dist/src/lib/token.utils.js.map +1 -0
- package/dist/src/lib/wellknown.api.d.ts +7 -0
- package/dist/src/lib/wellknown.api.d.ts.map +1 -0
- package/dist/src/lib/wellknown.api.js +22 -0
- package/dist/src/lib/wellknown.api.js.map +1 -0
- package/dist/src/types.d.ts +9 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +10 -0
- package/dist/src/types.js.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +35 -10
- package/CHANGELOG.md +0 -11
- package/dist/src/lib/token-store.d.ts +0 -12
- package/dist/src/lib/token-store.d.ts.map +0 -1
- package/dist/src/lib/token-store.js +0 -9
- package/dist/src/lib/token-store.test-d.d.ts +0 -2
- package/dist/src/lib/token-store.test-d.d.ts.map +0 -1
- package/dist/src/lib/token-store.test-d.js +0 -43
- package/eslint.config.mjs +0 -22
- package/src/index.ts +0 -1
- package/src/lib/token-store.test-d.ts +0 -52
- package/src/lib/token-store.test.ts +0 -38
- package/src/lib/token-store.ts +0 -10
- package/tsconfig.json +0 -22
- package/tsconfig.lib.json +0 -40
- package/tsconfig.spec.json +0 -41
- package/typedoc.json +0 -4
- package/vite.config.ts +0 -23
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Ping Identity Corporation. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* This software may be modified and distributed under the terms
|
|
5
|
+
* of the MIT license. See the LICENSE file for details.
|
|
6
|
+
*/
|
|
7
|
+
import { logger as loggerFn } from '@forgerock/sdk-logger';
|
|
8
|
+
import { createAuthorizeUrl } from '@forgerock/sdk-oidc';
|
|
9
|
+
import { createStorage } from '@forgerock/storage';
|
|
10
|
+
import { Micro } from 'effect';
|
|
11
|
+
import { exitIsFail, exitIsSuccess } from 'effect/Micro';
|
|
12
|
+
import { authorizeµ } from './authorize.request.js';
|
|
13
|
+
import { buildTokenExchangeµ } from './exchange.request.js';
|
|
14
|
+
import { createClientStore, createTokenError } from './client.store.utils.js';
|
|
15
|
+
import { oidcApi } from './oidc.api.js';
|
|
16
|
+
import { wellknownApi, wellknownSelector } from './wellknown.api.js';
|
|
17
|
+
import { isExpiryWithinThreshold } from './token.utils.js';
|
|
18
|
+
import { logoutµ } from './logout.request.js';
|
|
19
|
+
/**
|
|
20
|
+
* @function oidc
|
|
21
|
+
* @description Factory function to create an OIDC client with methods for authorization, token exchange,
|
|
22
|
+
* user info retrieval, and logout. It initializes the client with the provided configuration,
|
|
23
|
+
* request middleware, logger, and storage options.
|
|
24
|
+
* @param param - configuration object containing the OIDC client configuration, request middleware, logger,
|
|
25
|
+
* @param {OidcConfig} param.config - OIDC configuration including server details, client ID, redirect URI,
|
|
26
|
+
* storage options, scope, and response type.
|
|
27
|
+
* @param {RequestMiddleware} param.requestMiddleware - optional array of request middleware functions to process requests.
|
|
28
|
+
* @param {{ level: LogLevel, custom: CustomLogger }} param.logger - optional logger configuration with log level and custom logger.
|
|
29
|
+
* @param {Partial<StorageConfig>} param.storage - optional storage configuration for persisting OIDC tokens.
|
|
30
|
+
* @returns {ReturnType<typeof oidc>} - Returns an object with methods for authorization, token exchange, user info retrieval, and logout.
|
|
31
|
+
*/
|
|
32
|
+
export async function oidc({ config, requestMiddleware, logger, storage, }) {
|
|
33
|
+
const log = loggerFn({ level: logger?.level || 'error', custom: logger?.custom });
|
|
34
|
+
const oauthThreshold = config.oauthThreshold || 30 * 1000; // Default to 30 seconds
|
|
35
|
+
const storageClient = createStorage({
|
|
36
|
+
type: storage?.type || 'localStorage',
|
|
37
|
+
name: storage?.name || config.clientId,
|
|
38
|
+
prefix: storage?.prefix || 'pic',
|
|
39
|
+
...storage,
|
|
40
|
+
});
|
|
41
|
+
const store = createClientStore({ requestMiddleware, logger: log });
|
|
42
|
+
if (!config?.serverConfig?.wellknown) {
|
|
43
|
+
return {
|
|
44
|
+
error: 'Requires a wellknown url initializing this factory.',
|
|
45
|
+
type: 'argument_error',
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (!config?.clientId) {
|
|
49
|
+
return {
|
|
50
|
+
error: 'Requires a clientId.',
|
|
51
|
+
type: 'argument_error',
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const wellknownUrl = config.serverConfig.wellknown;
|
|
55
|
+
const { data, error } = await store.dispatch(wellknownApi.endpoints.configuration.initiate(wellknownUrl));
|
|
56
|
+
if (error || !data) {
|
|
57
|
+
log.error(`Error fetching wellknown config. Please check the URL: ${wellknownUrl}`);
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
/**
|
|
61
|
+
* An object containing methods for the creation, and background use, of the authorization URL
|
|
62
|
+
*/
|
|
63
|
+
authorize: {
|
|
64
|
+
/**
|
|
65
|
+
* @method url
|
|
66
|
+
* @description Creates an authorization URL with the provided options or defaults from the configuration.
|
|
67
|
+
* @param {GetAuthorizationUrlOptions} options - Optional parameters to customize the authorization URL.
|
|
68
|
+
* @returns {Promise<string | GenericError>} - Returns a promise that resolves to the authorization URL or an error.
|
|
69
|
+
*/
|
|
70
|
+
url: async (options) => {
|
|
71
|
+
const optionsWithDefaults = {
|
|
72
|
+
clientId: config.clientId,
|
|
73
|
+
redirectUri: config.redirectUri,
|
|
74
|
+
scope: config.scope || 'openid',
|
|
75
|
+
responseType: config.responseType || 'code',
|
|
76
|
+
...options,
|
|
77
|
+
};
|
|
78
|
+
const state = store.getState();
|
|
79
|
+
const wellknown = wellknownSelector(wellknownUrl, state);
|
|
80
|
+
if (!wellknown?.authorization_endpoint) {
|
|
81
|
+
return {
|
|
82
|
+
error: 'Authorization endpoint not found in wellknown configuration',
|
|
83
|
+
type: 'wellknown_error',
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return createAuthorizeUrl(wellknown.authorization_endpoint, optionsWithDefaults);
|
|
87
|
+
},
|
|
88
|
+
/**
|
|
89
|
+
* @function background - Initiates the authorization process in the background, returning an authorization URL or an error.
|
|
90
|
+
* @param {GetAuthorizationUrlOptions} options - Optional parameters to customize the authorization URL.
|
|
91
|
+
* @returns {Promise<AuthorizeErrorResponse | AuthorizeSuccessResponse>} - Returns a promise that resolves to the authorization URL or an error response.
|
|
92
|
+
*/
|
|
93
|
+
background: async (options) => {
|
|
94
|
+
const state = store.getState();
|
|
95
|
+
const wellknown = wellknownSelector(wellknownUrl, state);
|
|
96
|
+
if (!wellknown?.authorization_endpoint) {
|
|
97
|
+
return {
|
|
98
|
+
error: 'Wellknown missing authorization endpoint',
|
|
99
|
+
error_description: 'Authorization endpoint not found in wellknown configuration',
|
|
100
|
+
type: 'wellknown_error',
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
const result = await Micro.runPromiseExit(await authorizeµ(wellknown, config, log, store, options));
|
|
104
|
+
if (exitIsSuccess(result)) {
|
|
105
|
+
return result.value;
|
|
106
|
+
}
|
|
107
|
+
else if (exitIsFail(result)) {
|
|
108
|
+
return result.cause.error;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
return {
|
|
112
|
+
error: 'Authorization failure',
|
|
113
|
+
error_description: result.cause.message,
|
|
114
|
+
type: 'auth_error',
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
/**
|
|
120
|
+
* An object containing methods for token management
|
|
121
|
+
*/
|
|
122
|
+
token: {
|
|
123
|
+
/**
|
|
124
|
+
* @method exchange
|
|
125
|
+
* @description Exchanges an authorization code for tokens using the token endpoint from the wellknown
|
|
126
|
+
* configuration and stores them in the configured storage.
|
|
127
|
+
* @param {string} code - The authorization code received from the authorization server.
|
|
128
|
+
* @param {string} state - The state parameter from the authorization URL creation.
|
|
129
|
+
* @param {Partial<StorageConfig>} options - Optional storage configuration for persisting tokens.
|
|
130
|
+
* @returns {Promise<OauthTokens | GenericError | TokenExchangeErrorResponse>}
|
|
131
|
+
*/
|
|
132
|
+
exchange: async (code, state, options) => {
|
|
133
|
+
const storeState = store.getState();
|
|
134
|
+
const wellknown = wellknownSelector(wellknownUrl, storeState);
|
|
135
|
+
if (!wellknown?.token_endpoint) {
|
|
136
|
+
return {
|
|
137
|
+
error: 'Wellknown missing token endpoint',
|
|
138
|
+
type: 'wellknown_error',
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
const getTokensµ = buildTokenExchangeµ({
|
|
142
|
+
code,
|
|
143
|
+
config,
|
|
144
|
+
state,
|
|
145
|
+
log,
|
|
146
|
+
endpoint: wellknown.token_endpoint,
|
|
147
|
+
store,
|
|
148
|
+
options,
|
|
149
|
+
}).pipe(Micro.tap(async (tokens) => {
|
|
150
|
+
await storageClient.set(tokens);
|
|
151
|
+
}));
|
|
152
|
+
const result = await Micro.runPromiseExit(getTokensµ);
|
|
153
|
+
if (exitIsSuccess(result)) {
|
|
154
|
+
return result.value;
|
|
155
|
+
}
|
|
156
|
+
else if (exitIsFail(result)) {
|
|
157
|
+
return result.cause.error;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
return {
|
|
161
|
+
error: 'Token Exchange failure',
|
|
162
|
+
message: result.cause.message,
|
|
163
|
+
type: 'exchange_error',
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* @method get
|
|
169
|
+
* @description Retrieves the current OAuth tokens from storage, or auto-renew if backgroundRenew is true.
|
|
170
|
+
* @param {GetTokensOptions} param - An object containing options for the token retrieval.
|
|
171
|
+
* @returns {Promise<OauthTokens | TokenExchangeErrorResponse | AuthorizationError | GenericError>}
|
|
172
|
+
*/
|
|
173
|
+
get: async (options) => {
|
|
174
|
+
const { authorizeOptions, forceRenew, backgroundRenew, storageOptions } = options || {};
|
|
175
|
+
const state = store.getState();
|
|
176
|
+
const wellknown = wellknownSelector(wellknownUrl, state);
|
|
177
|
+
if (!wellknown?.authorization_endpoint) {
|
|
178
|
+
return {
|
|
179
|
+
error: 'Wellknown missing authorization endpoint',
|
|
180
|
+
type: 'wellknown_error',
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
const tokens = await storageClient.get();
|
|
184
|
+
// If there's an error, return early as there is an unknown issue from getting tokens
|
|
185
|
+
if (tokens && 'error' in tokens) {
|
|
186
|
+
return {
|
|
187
|
+
error: 'Error occurred while retrieving tokens',
|
|
188
|
+
message: 'Please log the user out completely and try again',
|
|
189
|
+
type: 'state_error',
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
// If forceRenew is false, we have tokens, and they are NOT expired, return them
|
|
193
|
+
if (!forceRenew &&
|
|
194
|
+
tokens &&
|
|
195
|
+
!isExpiryWithinThreshold(oauthThreshold, tokens.expiryTimestamp)) {
|
|
196
|
+
return tokens;
|
|
197
|
+
}
|
|
198
|
+
// If backgroundRenew and forceRenew is false return token, regardless of expiration, or the "no tokens found" error
|
|
199
|
+
if (!backgroundRenew && !forceRenew) {
|
|
200
|
+
return (tokens || {
|
|
201
|
+
error: 'No tokens found',
|
|
202
|
+
type: 'state_error',
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
// If we're here, backgroundRenew is true and we have no tokens, expired tokens or forceRenew is true
|
|
206
|
+
const attemptAuthorizeGetTokensµ = authorizeµ(wellknown, config, log, store, authorizeOptions).pipe(Micro.flatMap((response) => {
|
|
207
|
+
return buildTokenExchangeµ({
|
|
208
|
+
code: response.code,
|
|
209
|
+
config,
|
|
210
|
+
log,
|
|
211
|
+
state: response.state,
|
|
212
|
+
endpoint: wellknown.token_endpoint,
|
|
213
|
+
store,
|
|
214
|
+
options: storageOptions,
|
|
215
|
+
});
|
|
216
|
+
}), Micro.tap(async (tokens) => {
|
|
217
|
+
await store.dispatch(oidcApi.endpoints.revoke.initiate({
|
|
218
|
+
accessToken: tokens.accessToken,
|
|
219
|
+
clientId: config.clientId,
|
|
220
|
+
endpoint: wellknown.revocation_endpoint,
|
|
221
|
+
}));
|
|
222
|
+
await storageClient.remove();
|
|
223
|
+
await storageClient.set(tokens);
|
|
224
|
+
}));
|
|
225
|
+
const result = await Micro.runPromiseExit(attemptAuthorizeGetTokensµ);
|
|
226
|
+
if (exitIsSuccess(result)) {
|
|
227
|
+
return result.value;
|
|
228
|
+
}
|
|
229
|
+
else if (exitIsFail(result)) {
|
|
230
|
+
return result.cause.error;
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
return {
|
|
234
|
+
error: 'Background token renewal failed',
|
|
235
|
+
error_description: result.cause.message,
|
|
236
|
+
type: 'auth_error',
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
/**
|
|
241
|
+
* @method revoke
|
|
242
|
+
* @description Revokes an access token using the revocation endpoint from the wellknown configuration.
|
|
243
|
+
* It requires an access token stored in the configured storage.
|
|
244
|
+
* @returns {Promise<GenericError | RevokeSuccessResult | RevokeErrorResult>} - Returns a promise that resolves to the revoke response or an error response.
|
|
245
|
+
*/
|
|
246
|
+
revoke: async () => {
|
|
247
|
+
const state = store.getState();
|
|
248
|
+
const wellknown = wellknownSelector(wellknownUrl, state);
|
|
249
|
+
if (!wellknown?.revocation_endpoint) {
|
|
250
|
+
return {
|
|
251
|
+
error: 'Wellknown missing revocation endpoint',
|
|
252
|
+
type: 'wellknown_error',
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
const tokens = await storageClient.get();
|
|
256
|
+
if (!tokens || !('accessToken' in tokens)) {
|
|
257
|
+
return {
|
|
258
|
+
error: 'No access token found',
|
|
259
|
+
type: 'state_error',
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
const revokeµ = Micro.promise(() => store.dispatch(oidcApi.endpoints.revoke.initiate({
|
|
263
|
+
accessToken: tokens.accessToken,
|
|
264
|
+
clientId: config.clientId,
|
|
265
|
+
endpoint: wellknown.revocation_endpoint,
|
|
266
|
+
}))).pipe(Micro.map(({ error }) => {
|
|
267
|
+
if (error) {
|
|
268
|
+
let message = 'An error occurred while revoking the token';
|
|
269
|
+
let status = 'unknown';
|
|
270
|
+
if ('message' in error && error.message) {
|
|
271
|
+
message = error.message;
|
|
272
|
+
}
|
|
273
|
+
if ('status' in error) {
|
|
274
|
+
status = error.status;
|
|
275
|
+
}
|
|
276
|
+
return {
|
|
277
|
+
error: 'Token revocation failure',
|
|
278
|
+
message,
|
|
279
|
+
type: 'auth_error',
|
|
280
|
+
status,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
return null;
|
|
284
|
+
}),
|
|
285
|
+
// Delete local token and return combined results
|
|
286
|
+
Micro.flatMap((revokeResponse) => Micro.promise(() => storageClient.remove()).pipe(Micro.flatMap((deleteResponse) => {
|
|
287
|
+
const isInnerRequestError = (revokeResponse && 'error' in revokeResponse) ||
|
|
288
|
+
(deleteResponse && 'error' in deleteResponse);
|
|
289
|
+
if (isInnerRequestError) {
|
|
290
|
+
const result = {
|
|
291
|
+
error: 'Inner request error',
|
|
292
|
+
revokeResponse,
|
|
293
|
+
deleteResponse,
|
|
294
|
+
};
|
|
295
|
+
return Micro.fail(result);
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
const result = {
|
|
299
|
+
revokeResponse: null,
|
|
300
|
+
deleteResponse: null,
|
|
301
|
+
};
|
|
302
|
+
return Micro.succeed(result);
|
|
303
|
+
}
|
|
304
|
+
}))));
|
|
305
|
+
const result = await Micro.runPromiseExit(revokeµ);
|
|
306
|
+
if (exitIsSuccess(result)) {
|
|
307
|
+
return result.value;
|
|
308
|
+
}
|
|
309
|
+
else if (exitIsFail(result)) {
|
|
310
|
+
return result.cause.error;
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
return {
|
|
314
|
+
error: 'Token revocation failure',
|
|
315
|
+
message: result.cause.message,
|
|
316
|
+
type: 'auth_error',
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
/**
|
|
322
|
+
* An object containing methods for user info retrieval and logout
|
|
323
|
+
*/
|
|
324
|
+
user: {
|
|
325
|
+
/**
|
|
326
|
+
* @method info
|
|
327
|
+
* @description Retrieves user information using the userinfo endpoint from the wellknown configuration.
|
|
328
|
+
* It requires an access token stored in the configured storage.
|
|
329
|
+
* @returns {Promise<GenericError | UserInfoResponse>} - Returns a promise that resolves to user information or an error response.
|
|
330
|
+
*/
|
|
331
|
+
info: async () => {
|
|
332
|
+
const state = store.getState();
|
|
333
|
+
const wellknown = wellknownSelector(wellknownUrl, state);
|
|
334
|
+
if (!wellknown?.userinfo_endpoint) {
|
|
335
|
+
return {
|
|
336
|
+
error: 'Wellknown missing userinfo endpoint',
|
|
337
|
+
type: 'wellknown_error',
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
const tokens = await storageClient.get();
|
|
341
|
+
if (!tokens || !('accessToken' in tokens)) {
|
|
342
|
+
return {
|
|
343
|
+
error: 'No access token found',
|
|
344
|
+
type: 'auth_error',
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
const info = Micro.promise(() => store.dispatch(oidcApi.endpoints.userInfo.initiate({
|
|
348
|
+
accessToken: tokens.accessToken,
|
|
349
|
+
endpoint: wellknown.userinfo_endpoint,
|
|
350
|
+
}))).pipe(Micro.flatMap(({ data, error }) => {
|
|
351
|
+
if (error) {
|
|
352
|
+
let message = 'An error occurred while fetching user info';
|
|
353
|
+
let status = 'unknown';
|
|
354
|
+
if ('message' in error && error.message) {
|
|
355
|
+
message = error.message;
|
|
356
|
+
}
|
|
357
|
+
if ('status' in error) {
|
|
358
|
+
status = error.status;
|
|
359
|
+
}
|
|
360
|
+
return Micro.fail({
|
|
361
|
+
error: 'User Info retrieval failure',
|
|
362
|
+
message,
|
|
363
|
+
type: 'auth_error',
|
|
364
|
+
status,
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
return Micro.succeed(data);
|
|
368
|
+
}));
|
|
369
|
+
const result = await Micro.runPromiseExit(info);
|
|
370
|
+
if (exitIsSuccess(result)) {
|
|
371
|
+
return result.value;
|
|
372
|
+
}
|
|
373
|
+
else if (exitIsFail(result)) {
|
|
374
|
+
return result.cause.error;
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
return {
|
|
378
|
+
error: 'User Info retrieval failure',
|
|
379
|
+
message: result.cause.message,
|
|
380
|
+
type: 'auth_error',
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
/**
|
|
385
|
+
* @method logout
|
|
386
|
+
* @description Logs out the user by revoking tokens and clearing the storage.
|
|
387
|
+
* It uses the end session endpoint from the wellknown configuration.
|
|
388
|
+
* @returns {Promise<GenericError | LogoutSuccessResult | LogoutErrorResult>} - Returns a promise that resolves to the logout response or an error.
|
|
389
|
+
*/
|
|
390
|
+
logout: async () => {
|
|
391
|
+
const state = store.getState();
|
|
392
|
+
const wellknown = wellknownSelector(wellknownUrl, state);
|
|
393
|
+
if (!wellknown?.end_session_endpoint) {
|
|
394
|
+
return {
|
|
395
|
+
error: 'Wellknown missing end session endpoint',
|
|
396
|
+
type: 'wellknown_error',
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
if (!wellknown?.revocation_endpoint) {
|
|
400
|
+
return {
|
|
401
|
+
error: 'Wellknown missing revocation endpoint',
|
|
402
|
+
type: 'wellknown_error',
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
const tokens = await storageClient.get();
|
|
406
|
+
if (!tokens) {
|
|
407
|
+
return createTokenError('no_tokens');
|
|
408
|
+
}
|
|
409
|
+
if (!('accessToken' in tokens)) {
|
|
410
|
+
return createTokenError('no_access_token');
|
|
411
|
+
}
|
|
412
|
+
if (!('idToken' in tokens)) {
|
|
413
|
+
return createTokenError('no_id_token');
|
|
414
|
+
}
|
|
415
|
+
const result = await Micro.runPromiseExit(logoutµ({ tokens, config, wellknown, store, storageClient }));
|
|
416
|
+
if (exitIsSuccess(result)) {
|
|
417
|
+
return result.value;
|
|
418
|
+
}
|
|
419
|
+
else if (exitIsFail(result)) {
|
|
420
|
+
return result.cause.error;
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
return {
|
|
424
|
+
error: 'Logout_Failure',
|
|
425
|
+
message: result.cause.message,
|
|
426
|
+
type: 'auth_error',
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
},
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
//# sourceMappingURL=client.store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.store.js","sourceRoot":"","sources":["../../../src/lib/client.store.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE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CAAC,iBAAiB,CAAC,CAAC;gBAC7C,CAAC;gBAED,IAAI,CAAC,CAAC,SAAS,IAAI,MAAM,CAAC,EAAE,CAAC;oBAC3B,OAAO,gBAAgB,CAAC,aAAa,CAAC,CAAC;gBACzC,CAAC;gBAED,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,cAAc,CACvC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,CAC7D,CAAC;gBAEF,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;oBAC1B,OAAO,MAAM,CAAC,KAAK,CAAC;gBACtB,CAAC;qBAAM,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;oBAC9B,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;gBAC5B,CAAC;qBAAM,CAAC;oBACN,OAAO;wBACL,KAAK,EAAE,gBAAgB;wBACvB,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;wBAC7B,IAAI,EAAE,YAAY;qBACnB,CAAC;gBACJ,CAAC;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { ActionTypes, RequestMiddleware } from '@forgerock/sdk-request-middleware';
|
|
2
|
+
import { logger as loggerFn } from '@forgerock/sdk-logger';
|
|
3
|
+
import { type SerializedError } from '@reduxjs/toolkit';
|
|
4
|
+
import type { GenericError } from '@forgerock/sdk-types';
|
|
5
|
+
import type { FetchBaseQueryError } from '@reduxjs/toolkit/query';
|
|
6
|
+
/**
|
|
7
|
+
* @function createClientStore
|
|
8
|
+
* @description Creates a Redux store configured with OIDC and well-known APIs.
|
|
9
|
+
* @param param - Configuration options for the client store.
|
|
10
|
+
* @param {RequestMiddleware} param.requestMiddleware - An array of request middleware functions to be applied to the store.
|
|
11
|
+
* @param {ReturnType<typeof loggerFn>} param.logger - An optional logger function for logging messages.
|
|
12
|
+
* @returns { ReturnType<typeof configureStore> } - Returns a configured Redux store with OIDC and well-known APIs.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createClientStore<ActionType extends ActionTypes>({ requestMiddleware, logger, }: {
|
|
15
|
+
requestMiddleware?: RequestMiddleware<ActionType, unknown>[];
|
|
16
|
+
logger?: ReturnType<typeof loggerFn>;
|
|
17
|
+
}): import("@reduxjs/toolkit").EnhancedStore<{
|
|
18
|
+
oidc: import("@reduxjs/toolkit/query").CombinedState<{
|
|
19
|
+
authorizeFetch: import("@reduxjs/toolkit/query").MutationDefinition<{
|
|
20
|
+
url: string;
|
|
21
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, import("./authorize.request.types.js").AuthorizeSuccessResponse, "oidc", unknown>;
|
|
22
|
+
authorizeIframe: import("@reduxjs/toolkit/query").MutationDefinition<{
|
|
23
|
+
url: string;
|
|
24
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, import("./authorize.request.types.js").AuthorizationSuccess, "oidc", unknown>;
|
|
25
|
+
endSession: import("@reduxjs/toolkit/query").MutationDefinition<{
|
|
26
|
+
idToken: string;
|
|
27
|
+
endpoint: string;
|
|
28
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, null, "oidc", unknown>;
|
|
29
|
+
exchange: import("@reduxjs/toolkit/query").MutationDefinition<{
|
|
30
|
+
code: string;
|
|
31
|
+
config: import("./config.types.js").OidcConfig;
|
|
32
|
+
endpoint: string;
|
|
33
|
+
verifier?: string;
|
|
34
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, import("./exchange.types.js").TokenExchangeResponse, "oidc", unknown>;
|
|
35
|
+
revoke: import("@reduxjs/toolkit/query").MutationDefinition<{
|
|
36
|
+
accessToken: string;
|
|
37
|
+
clientId?: string;
|
|
38
|
+
endpoint: string;
|
|
39
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, object, "oidc", unknown>;
|
|
40
|
+
userInfo: import("@reduxjs/toolkit/query").MutationDefinition<{
|
|
41
|
+
accessToken: string;
|
|
42
|
+
endpoint: string;
|
|
43
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, import("./client.types.js").UserInfoResponse, "oidc", unknown>;
|
|
44
|
+
}, never, "oidc">;
|
|
45
|
+
wellknown: import("@reduxjs/toolkit/query").CombinedState<{
|
|
46
|
+
configuration: import("@reduxjs/toolkit/query").QueryDefinition<string, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, import("@forgerock/sdk-types").WellKnownResponse, "wellknown", unknown>;
|
|
47
|
+
}, never, "wellknown">;
|
|
48
|
+
}, import("@reduxjs/toolkit").UnknownAction, import("@reduxjs/toolkit").Tuple<[import("@reduxjs/toolkit").StoreEnhancer<{
|
|
49
|
+
dispatch: import("@reduxjs/toolkit").ThunkDispatch<{
|
|
50
|
+
oidc: import("@reduxjs/toolkit/query").CombinedState<{
|
|
51
|
+
authorizeFetch: import("@reduxjs/toolkit/query").MutationDefinition<{
|
|
52
|
+
url: string;
|
|
53
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, import("./authorize.request.types.js").AuthorizeSuccessResponse, "oidc", unknown>;
|
|
54
|
+
authorizeIframe: import("@reduxjs/toolkit/query").MutationDefinition<{
|
|
55
|
+
url: string;
|
|
56
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, import("./authorize.request.types.js").AuthorizationSuccess, "oidc", unknown>;
|
|
57
|
+
endSession: import("@reduxjs/toolkit/query").MutationDefinition<{
|
|
58
|
+
idToken: string;
|
|
59
|
+
endpoint: string;
|
|
60
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, null, "oidc", unknown>;
|
|
61
|
+
exchange: import("@reduxjs/toolkit/query").MutationDefinition<{
|
|
62
|
+
code: string;
|
|
63
|
+
config: import("./config.types.js").OidcConfig;
|
|
64
|
+
endpoint: string;
|
|
65
|
+
verifier?: string;
|
|
66
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, import("./exchange.types.js").TokenExchangeResponse, "oidc", unknown>;
|
|
67
|
+
revoke: import("@reduxjs/toolkit/query").MutationDefinition<{
|
|
68
|
+
accessToken: string;
|
|
69
|
+
clientId?: string;
|
|
70
|
+
endpoint: string;
|
|
71
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, object, "oidc", unknown>;
|
|
72
|
+
userInfo: import("@reduxjs/toolkit/query").MutationDefinition<{
|
|
73
|
+
accessToken: string;
|
|
74
|
+
endpoint: string;
|
|
75
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, import("./client.types.js").UserInfoResponse, "oidc", unknown>;
|
|
76
|
+
}, never, "oidc">;
|
|
77
|
+
wellknown: import("@reduxjs/toolkit/query").CombinedState<{
|
|
78
|
+
configuration: import("@reduxjs/toolkit/query").QueryDefinition<string, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, import("@forgerock/sdk-types").WellKnownResponse, "wellknown", unknown>;
|
|
79
|
+
}, never, "wellknown">;
|
|
80
|
+
}, {
|
|
81
|
+
/**
|
|
82
|
+
* This becomes the `api.extra` argument, and will be passed into the
|
|
83
|
+
* customer query wrapper for `baseQuery`
|
|
84
|
+
*/
|
|
85
|
+
requestMiddleware: RequestMiddleware<ActionType, unknown>[] | undefined;
|
|
86
|
+
logger: {
|
|
87
|
+
changeLevel: (level: import("@forgerock/sdk-logger").LogLevel) => void;
|
|
88
|
+
error: (...args: import("@forgerock/sdk-logger").LogMessage[]) => void;
|
|
89
|
+
warn: (...args: import("@forgerock/sdk-logger").LogMessage[]) => void;
|
|
90
|
+
info: (...args: import("@forgerock/sdk-logger").LogMessage[]) => void;
|
|
91
|
+
debug: (...args: import("@forgerock/sdk-logger").LogMessage[]) => void;
|
|
92
|
+
} | undefined;
|
|
93
|
+
}, import("@reduxjs/toolkit").UnknownAction>;
|
|
94
|
+
}>, import("@reduxjs/toolkit").StoreEnhancer]>>;
|
|
95
|
+
/**
|
|
96
|
+
* @function createLogoutError
|
|
97
|
+
* @description Creates a logout error object based on the provided data and error.
|
|
98
|
+
* @param {object | null | undefined} data - The data returned from the logout API call.
|
|
99
|
+
* @param {FetchBaseQueryError | SerializedError} error - An optional error object that may contain details about the error that occurred during the logout process.
|
|
100
|
+
* @returns {null | GenericError} - Returns a `GenericError` object if an error occurred, or `null` if no error is present.
|
|
101
|
+
*/
|
|
102
|
+
export declare function createLogoutError(data: object | null | undefined, error?: FetchBaseQueryError | SerializedError): null | GenericError;
|
|
103
|
+
export declare function createTokenError(type: 'no_tokens' | 'no_access_token' | 'no_id_token'): GenericError;
|
|
104
|
+
//# sourceMappingURL=client.store.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.store.utils.d.ts","sourceRoot":"","sources":["../../../src/lib/client.store.utils.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAIxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElE;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,SAAS,WAAW,EAAE,EAChE,iBAAiB,EACjB,MAAM,GACP,EAAE;IACD,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC;IAC7D,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;CACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAUW;;;WAGG;;;;oBArCM,GAAG;mBAAwC,GAAG;mBAChD,GAAE;oBAEpB,GAAG;;;gDA2CH;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/B,KAAK,CAAC,EAAE,mBAAmB,GAAG,eAAe,GAC5C,IAAI,GAAG,YAAY,CAkBrB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG,iBAAiB,GAAG,aAAa,gBA8BrF"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { configureStore } from '@reduxjs/toolkit';
|
|
2
|
+
import { oidcApi } from './oidc.api.js';
|
|
3
|
+
import { wellknownApi } from './wellknown.api.js';
|
|
4
|
+
/**
|
|
5
|
+
* @function createClientStore
|
|
6
|
+
* @description Creates a Redux store configured with OIDC and well-known APIs.
|
|
7
|
+
* @param param - Configuration options for the client store.
|
|
8
|
+
* @param {RequestMiddleware} param.requestMiddleware - An array of request middleware functions to be applied to the store.
|
|
9
|
+
* @param {ReturnType<typeof loggerFn>} param.logger - An optional logger function for logging messages.
|
|
10
|
+
* @returns { ReturnType<typeof configureStore> } - Returns a configured Redux store with OIDC and well-known APIs.
|
|
11
|
+
*/
|
|
12
|
+
export function createClientStore({ requestMiddleware, logger, }) {
|
|
13
|
+
return configureStore({
|
|
14
|
+
reducer: {
|
|
15
|
+
[oidcApi.reducerPath]: oidcApi.reducer,
|
|
16
|
+
[wellknownApi.reducerPath]: wellknownApi.reducer,
|
|
17
|
+
},
|
|
18
|
+
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
19
|
+
thunk: {
|
|
20
|
+
extraArgument: {
|
|
21
|
+
/**
|
|
22
|
+
* This becomes the `api.extra` argument, and will be passed into the
|
|
23
|
+
* customer query wrapper for `baseQuery`
|
|
24
|
+
*/
|
|
25
|
+
requestMiddleware,
|
|
26
|
+
logger,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
})
|
|
30
|
+
.concat(wellknownApi.middleware)
|
|
31
|
+
.concat(oidcApi.middleware),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @function createLogoutError
|
|
36
|
+
* @description Creates a logout error object based on the provided data and error.
|
|
37
|
+
* @param {object | null | undefined} data - The data returned from the logout API call.
|
|
38
|
+
* @param {FetchBaseQueryError | SerializedError} error - An optional error object that may contain details about the error that occurred during the logout process.
|
|
39
|
+
* @returns {null | GenericError} - Returns a `GenericError` object if an error occurred, or `null` if no error is present.
|
|
40
|
+
*/
|
|
41
|
+
export function createLogoutError(data, error) {
|
|
42
|
+
if (error) {
|
|
43
|
+
let message = 'An error occurred while ending the session';
|
|
44
|
+
let status = 'unknown';
|
|
45
|
+
if ('message' in error && error.message) {
|
|
46
|
+
message = error.message;
|
|
47
|
+
}
|
|
48
|
+
if ('status' in error) {
|
|
49
|
+
status = error.status;
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
error: 'End Session failure',
|
|
53
|
+
message,
|
|
54
|
+
type: 'auth_error',
|
|
55
|
+
status,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
export function createTokenError(type) {
|
|
61
|
+
let error;
|
|
62
|
+
if (type === 'no_tokens') {
|
|
63
|
+
error = {
|
|
64
|
+
error: 'Token_Error',
|
|
65
|
+
message: 'Required for ending session and revoking access token',
|
|
66
|
+
type: 'state_error',
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
else if (type === 'no_access_token') {
|
|
70
|
+
error = {
|
|
71
|
+
error: 'Token_Error',
|
|
72
|
+
message: 'No access token found in storage; required for revoking access token',
|
|
73
|
+
type: 'state_error',
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
else if (type === 'no_id_token') {
|
|
77
|
+
error = {
|
|
78
|
+
error: 'Token_Error',
|
|
79
|
+
message: 'No ID token found in storage; required for ending session',
|
|
80
|
+
type: 'state_error',
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
error = {
|
|
85
|
+
error: 'Token_Error',
|
|
86
|
+
message: 'An unknown error occurred while creating the error object',
|
|
87
|
+
type: 'unknown_error',
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return error;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=client.store.utils.js.map
|