@asgardeo/javascript 0.1.0 → 0.1.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.
Files changed (47) hide show
  1. package/dist/AsgardeoJavaScriptClient.d.ts +19 -52
  2. package/dist/IsomorphicCrypto.d.ts +2 -2
  3. package/dist/StorageManager.d.ts +1 -1
  4. package/dist/__legacy__/client.d.ts +2 -2
  5. package/dist/__legacy__/helpers/authentication-helper.d.ts +3 -3
  6. package/dist/api/createOrganization.d.ts +129 -0
  7. package/dist/api/executeEmbeddedSignInFlow.d.ts +21 -0
  8. package/dist/api/executeEmbeddedSignUpFlow.d.ts +44 -0
  9. package/dist/api/getAllOrganizations.d.ts +112 -0
  10. package/dist/api/getBrandingPreference.d.ts +103 -0
  11. package/dist/api/getMeOrganizations.d.ts +119 -0
  12. package/dist/api/getOrganization.d.ts +109 -0
  13. package/dist/api/getSchemas.d.ts +89 -0
  14. package/dist/api/getScim2Me.d.ts +89 -0
  15. package/dist/api/initializeEmbeddedSignInFlow.d.ts +51 -0
  16. package/dist/api/updateMeProfile.d.ts +82 -0
  17. package/dist/api/updateOrganization.d.ts +118 -0
  18. package/dist/cjs/index.js +1100 -157
  19. package/dist/cjs/index.js.map +4 -4
  20. package/dist/constants/OIDCRequestConstants.d.ts +1 -1
  21. package/dist/constants/ScopeConstants.d.ts +3 -6
  22. package/dist/constants/TokenExchangeConstants.d.ts +2 -2
  23. package/dist/constants/VendorConstants.d.ts +31 -0
  24. package/dist/index.d.ts +24 -6
  25. package/dist/index.js +1071 -148
  26. package/dist/index.js.map +4 -4
  27. package/dist/models/branding-preference.d.ts +248 -0
  28. package/dist/models/client.d.ts +55 -5
  29. package/dist/models/config.d.ts +54 -12
  30. package/dist/models/embedded-flow.d.ts +66 -0
  31. package/dist/models/embedded-signin-flow.d.ts +99 -0
  32. package/dist/models/flow.d.ts +30 -0
  33. package/dist/models/i18n.d.ts +24 -0
  34. package/dist/models/organization.d.ts +24 -0
  35. package/dist/models/token.d.ts +42 -30
  36. package/dist/theme/createTheme.d.ts +1 -1
  37. package/dist/theme/types.d.ts +42 -17
  38. package/dist/utils/deriveOrganizationHandleFromBaseUrl.d.ts +47 -0
  39. package/dist/utils/extractTenantDomainFromIdTokenPayload.d.ts +2 -2
  40. package/dist/utils/extractUserClaimsFromIdToken.d.ts +2 -2
  41. package/dist/utils/generateFlattenedUserProfile.d.ts +9 -2
  42. package/dist/utils/isEmpty.d.ts +48 -0
  43. package/dist/utils/withVendorCSSClassPrefix.d.ts +32 -0
  44. package/package.json +1 -1
  45. package/dist/api/handleApplicationNativeAuthentication.d.ts +0 -33
  46. package/dist/api/initializeApplicationNativeAuthentication.d.ts +0 -117
  47. package/dist/models/application-native-authentication.d.ts +0 -82
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ export interface Organization {
19
+ id: string;
20
+ name: string;
21
+ orgHandle: string;
22
+ ref?: string;
23
+ status?: string;
24
+ }
@@ -31,11 +31,11 @@ export interface TokenResponse {
31
31
  */
32
32
  accessToken: string;
33
33
  /**
34
- * JSON Web Token (JWT) containing user identity information.
35
- * This token can be decoded to access user claims and metadata
36
- * without additional server requests.
34
+ * Unix timestamp (in seconds) when the token was created.
35
+ * Used in combination with expiresIn to determine when
36
+ * the token needs to be refreshed.
37
37
  */
38
- idToken: string;
38
+ createdAt: number;
39
39
  /**
40
40
  * Duration in seconds until the access token expires.
41
41
  * Applications should refresh the token before this time
@@ -43,29 +43,29 @@ export interface TokenResponse {
43
43
  */
44
44
  expiresIn: string;
45
45
  /**
46
- * Space-separated list of OAuth scopes granted to the application.
47
- * These scopes determine what resources and actions the application
48
- * has permission to access.
46
+ * JSON Web Token (JWT) containing user identity information.
47
+ * This token can be decoded to access user claims and metadata
48
+ * without additional server requests.
49
49
  */
50
- scope: string;
50
+ idToken: string;
51
51
  /**
52
52
  * Token used to obtain new access tokens without re-authentication.
53
53
  * Store this securely as it enables long-term access to the user's
54
54
  * account through the refresh flow.
55
55
  */
56
56
  refreshToken: string;
57
+ /**
58
+ * Space-separated list of OAuth scopes granted to the application.
59
+ * These scopes determine what resources and actions the application
60
+ * has permission to access.
61
+ */
62
+ scope: string;
57
63
  /**
58
64
  * The type of token issued, typically "Bearer".
59
65
  * This indicates how the token should be used in
60
66
  * API request Authorization headers.
61
67
  */
62
68
  tokenType: string;
63
- /**
64
- * Unix timestamp (in seconds) when the token was created.
65
- * Used in combination with expiresIn to determine when
66
- * the token needs to be refreshed.
67
- */
68
- createdAt: number;
69
69
  }
70
70
  /**
71
71
  * Represents the raw token response received directly from the authentication server.
@@ -82,18 +82,18 @@ export interface AccessTokenApiResponse {
82
82
  * before any processing or validation.
83
83
  */
84
84
  access_token: string;
85
- /**
86
- * Raw expiration time in seconds.
87
- * Indicates how long the access token will be valid
88
- * from the time it was issued.
89
- */
90
- expires_in: string;
91
85
  /**
92
86
  * Server-provided creation timestamp in Unix seconds.
93
87
  * Used to track when the token was originally issued
94
88
  * and calculate absolute expiration time.
95
89
  */
96
90
  created_at: number;
91
+ /**
92
+ * Raw expiration time in seconds.
93
+ * Indicates how long the access token will be valid
94
+ * from the time it was issued.
95
+ */
96
+ expires_in: string;
97
97
  /**
98
98
  * Raw ID token string containing encoded user information.
99
99
  * This JWT can be decoded to access standardized claims
@@ -122,27 +122,39 @@ export interface AccessTokenApiResponse {
122
122
  /**
123
123
  * Interface for the standard (required) claims of an ID Token payload.
124
124
  */
125
- export interface IdTokenPayloadStandardClaims {
125
+ export interface KnownIdToken {
126
126
  /**
127
127
  * The audience for which this token is intended.
128
128
  */
129
129
  aud: string | string[];
130
130
  /**
131
- * The unique identifier of the user to whom the ID token belongs.
131
+ * The email of the user.
132
132
  */
133
- sub: string;
133
+ email?: string;
134
134
  /**
135
135
  * The issuer identifier for the issuer of the response.
136
136
  */
137
137
  iss: string;
138
138
  /**
139
- * The email of the user.
139
+ * The unique human readable slug of the organization to which the user belongs.
140
140
  */
141
- email?: string;
141
+ org_handle?: string;
142
+ /**
143
+ * The unique identifier of the organization to which the user belongs.
144
+ */
145
+ org_id?: string;
146
+ /**
147
+ * The human readable name of the organization to which the user belongs.
148
+ */
149
+ org_name?: string;
142
150
  /**
143
151
  * The username the user prefers to be called.
144
152
  */
145
153
  preferred_username?: string;
154
+ /**
155
+ * The unique identifier of the user to whom the ID token belongs.
156
+ */
157
+ sub: string;
146
158
  /**
147
159
  * The tenant domain of the user.
148
160
  */
@@ -151,18 +163,18 @@ export interface IdTokenPayloadStandardClaims {
151
163
  /**
152
164
  * Interface for ID Token payload including custom claims.
153
165
  */
154
- export interface IdTokenPayload extends IdTokenPayloadStandardClaims {
166
+ export interface IdToken extends KnownIdToken {
155
167
  /**
156
168
  * Other custom claims.
157
169
  */
158
170
  [claim: string]: any;
159
171
  }
160
172
  export interface TokenExchangeRequestConfig {
161
- id: string;
162
- data: any;
163
- signInRequired: boolean;
164
173
  attachToken: boolean;
174
+ data: any;
175
+ id: string;
165
176
  returnsSession: boolean;
166
- tokenEndpoint?: string;
167
177
  shouldReplayAfterRefresh?: boolean;
178
+ signInRequired: boolean;
179
+ tokenEndpoint?: string;
168
180
  }
@@ -15,7 +15,7 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { RecursivePartial } from '../models/utility-types';
19
18
  import { Theme, ThemeConfig } from './types';
19
+ import { RecursivePartial } from '../models/utility-types';
20
20
  declare const createTheme: (config?: RecursivePartial<ThemeConfig>, isDark?: boolean) => Theme;
21
21
  export default createTheme;
@@ -16,43 +16,68 @@
16
16
  * under the License.
17
17
  */
18
18
  export interface ThemeColors {
19
- primary: {
19
+ background: {
20
+ body: {
21
+ main: string;
22
+ };
23
+ disabled: string;
24
+ surface: string;
25
+ };
26
+ border: string;
27
+ error: {
28
+ contrastText: string;
20
29
  main: string;
30
+ };
31
+ primary: {
21
32
  contrastText: string;
33
+ main: string;
22
34
  };
23
35
  secondary: {
24
- main: string;
25
36
  contrastText: string;
37
+ main: string;
26
38
  };
27
- background: {
28
- surface: string;
29
- disabled: string;
30
- body: {
31
- main: string;
32
- };
39
+ success: {
40
+ contrastText: string;
41
+ main: string;
33
42
  };
34
43
  text: {
35
44
  primary: string;
36
45
  secondary: string;
37
46
  };
38
- border: string;
39
- error: {
40
- main: string;
47
+ warning: {
41
48
  contrastText: string;
49
+ main: string;
42
50
  };
43
51
  }
44
52
  export interface ThemeConfig {
45
- colors: ThemeColors;
46
- spacing: {
47
- unit: number;
48
- };
49
53
  borderRadius: {
50
- small: string;
54
+ large: string;
51
55
  medium: string;
56
+ small: string;
57
+ };
58
+ colors: ThemeColors;
59
+ shadows: {
52
60
  large: string;
61
+ medium: string;
62
+ small: string;
63
+ };
64
+ spacing: {
65
+ unit: number;
53
66
  };
54
67
  }
55
68
  export interface Theme extends ThemeConfig {
56
69
  cssVariables: Record<string, string>;
57
70
  }
58
- export type ThemeMode = 'light' | 'dark' | 'system';
71
+ export type ThemeMode = 'light' | 'dark' | 'system' | 'class';
72
+ export interface ThemeDetection {
73
+ /**
74
+ * The CSS class name to detect for dark mode (without the dot)
75
+ * @default 'dark'
76
+ */
77
+ darkClass?: string;
78
+ /**
79
+ * The CSS class name to detect for light mode (without the dot)
80
+ * @default 'light'
81
+ */
82
+ lightClass?: string;
83
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ /**
19
+ * Extracts the organization handle from an Asgardeo base URL.
20
+ *
21
+ * This function parses Asgardeo URLs with the standard pattern:
22
+ * - https://dev.asgardeo.io/t/{orgHandle}
23
+ * - https://stage.asgardeo.io/t/{orgHandle}
24
+ * - https://prod.asgardeo.io/t/{orgHandle}
25
+ * - https://{subdomain}.asgardeo.io/t/{orgHandle}
26
+ *
27
+ * @param baseUrl - The base URL of the Asgardeo identity server
28
+ * @returns The extracted organization handle
29
+ * @throws {AsgardeoRuntimeError} When the URL doesn't match the expected Asgardeo pattern,
30
+ * indicating a custom domain is configured and organizationHandle must be provided explicitly
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * // Standard Asgardeo URLs
35
+ * const handle1 = deriveOrganizationHandleFromBaseUrl('https://dev.asgardeo.io/t/dxlab');
36
+ * // Returns: 'dxlab'
37
+ *
38
+ * const handle2 = deriveOrganizationHandleFromBaseUrl('https://stage.asgardeo.io/t/myorg');
39
+ * // Returns: 'myorg'
40
+ *
41
+ * // Custom domain - throws error
42
+ * deriveOrganizationHandleFromBaseUrl('https://custom.example.com/auth');
43
+ * // Throws: AsgardeoRuntimeError
44
+ * ```
45
+ */
46
+ declare const deriveOrganizationHandleFromBaseUrl: (baseUrl?: string) => string;
47
+ export default deriveOrganizationHandleFromBaseUrl;
@@ -15,7 +15,7 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { IdTokenPayload } from '../models/token';
18
+ import { IdToken } from '../models/token';
19
19
  /**
20
20
  * Extracts the tenant domain from the ID token payload.
21
21
  *
@@ -27,5 +27,5 @@ import { IdTokenPayload } from '../models/token';
27
27
  *
28
28
  * Consider extracting the tenant domain using a dedicated claim (e.g., `tenant_domain`) when available.
29
29
  */
30
- declare const extractTenantDomainFromIdTokenPayload: (payload: IdTokenPayload, subjectSeparator?: string) => string;
30
+ declare const extractTenantDomainFromIdTokenPayload: (payload: IdToken, subjectSeparator?: string) => string;
31
31
  export default extractTenantDomainFromIdTokenPayload;
@@ -15,7 +15,7 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { IdTokenPayload } from '../models/token';
18
+ import { IdToken } from '../models/token';
19
19
  /**
20
20
  * Removes standard protocol-specific claims from the ID token payload
21
21
  * and returns a camelCased object of user-specific claims.
@@ -40,5 +40,5 @@ import { IdTokenPayload } from '../models/token';
40
40
  * // }
41
41
  * ```
42
42
  */
43
- declare const extractUserClaimsFromIdToken: (payload: IdTokenPayload) => Record<string, unknown>;
43
+ declare const extractUserClaimsFromIdToken: (payload: IdToken) => Record<string, unknown>;
44
44
  export default extractUserClaimsFromIdToken;
@@ -23,6 +23,9 @@ import { User } from '../models/user';
23
23
  * a flat object with dot notation keys instead of nested objects. Multi-valued
24
24
  * properties and type-specific defaults are handled appropriately.
25
25
  *
26
+ * Additionally, any fields present in the response but not defined in the schema
27
+ * will be included to ensure no user data is lost during flattening.
28
+ *
26
29
  * @param meResponse - The response object containing user data
27
30
  * @param processedSchemas - Array of schema objects defining field properties
28
31
  * @param processedSchemas[].name - The field name/path for the property
@@ -37,9 +40,13 @@ import { User } from '../models/user';
37
40
  * { name: 'name.givenName', type: 'STRING', multiValued: false },
38
41
  * { name: 'emails', type: 'STRING', multiValued: true }
39
42
  * ];
40
- * const response = { name: { givenName: 'John' }, emails: 'john@example.com' };
43
+ * const response = {
44
+ * name: { givenName: 'John' },
45
+ * emails: 'john@example.com',
46
+ * country: 'US' // This will be included even if not in schema
47
+ * };
41
48
  * const profile = generateFlattenedUserProfile(response, schemas);
42
- * // Result: { "name.givenName": 'John', emails: ['john@example.com'] }
49
+ * // Result: { "name.givenName": 'John', emails: ['john@example.com'], country: 'US' }
43
50
  * ```
44
51
  */
45
52
  declare const generateFlattenedUserProfile: (meResponse: any, processedSchemas: any[]) => User;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ /**
19
+ * Checks if a value is considered empty.
20
+ *
21
+ * A value is considered empty if it is:
22
+ * - null
23
+ * - undefined
24
+ * - empty string ("")
25
+ * - string containing only whitespace characters
26
+ * - empty array ([])
27
+ * - empty object ({})
28
+ *
29
+ * @param value - The value to check
30
+ * @returns true if the value is empty, false otherwise
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * isEmpty(null); // true
35
+ * isEmpty(undefined); // true
36
+ * isEmpty(""); // true
37
+ * isEmpty(" "); // true
38
+ * isEmpty("hello"); // false
39
+ * isEmpty([]); // true
40
+ * isEmpty([1, 2, 3]); // false
41
+ * isEmpty({}); // true
42
+ * isEmpty({ name: "John" }); // false
43
+ * isEmpty(0); // false
44
+ * isEmpty(false); // false
45
+ * ```
46
+ */
47
+ declare const isEmpty: (value: any) => boolean;
48
+ export default isEmpty;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ /**
19
+ * Adds a vendor-specific prefix to a CSS class name.
20
+ *
21
+ * @param className - The original CSS class name to be prefixed
22
+ * @returns A new string with the vendor prefix added to the class name
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * // Usage with clsx
27
+ * clsx(withVendorCSSClassPrefix('sign-in-button'), className)
28
+ * // Result: "wso2-sign-in-button"
29
+ * ```
30
+ */
31
+ declare const withVendorCSSClassPrefix: (className: string) => string;
32
+ export default withVendorCSSClassPrefix;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asgardeo/javascript",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Framework agnostic JavaScript SDK for Asgardeo.",
5
5
  "keywords": [
6
6
  "asgardeo",
@@ -1,33 +0,0 @@
1
- /**
2
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
- *
4
- * WSO2 LLC. licenses this file to you under the Apache License,
5
- * Version 2.0 (the "License"); you may not use this file except
6
- * in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing,
12
- * software distributed under the License is distributed on an
13
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
- * KIND, either express or implied. See the License for the
15
- * specific language governing permissions and limitations
16
- * under the License.
17
- */
18
- import { ApplicationNativeAuthenticationHandleRequestPayload, ApplicationNativeAuthenticationHandleResponse } from '../models/application-native-authentication';
19
- /**
20
- * Request configuration for the authorize function.
21
- */
22
- export interface AuthorizeRequestConfig extends Partial<Request> {
23
- /**
24
- * The base URL of the Asgardeo server.
25
- */
26
- baseUrl?: string;
27
- /**
28
- * The authorization request payload.
29
- */
30
- payload: ApplicationNativeAuthenticationHandleRequestPayload;
31
- }
32
- declare const handleApplicationNativeAuthentication: ({ url, baseUrl, payload, ...requestConfig }: AuthorizeRequestConfig) => Promise<ApplicationNativeAuthenticationHandleResponse>;
33
- export default handleApplicationNativeAuthentication;
@@ -1,117 +0,0 @@
1
- /**
2
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
- *
4
- * WSO2 LLC. licenses this file to you under the Apache License,
5
- * Version 2.0 (the "License"); you may not use this file except
6
- * in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing,
12
- * software distributed under the License is distributed on an
13
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
- * KIND, either express or implied. See the License for the
15
- * specific language governing permissions and limitations
16
- * under the License.
17
- */
18
- import { ApplicationNativeAuthenticationInitiateResponse } from '../models/application-native-authentication';
19
- /**
20
- * Represents the authorization request payload that can be sent to the authorization endpoint.
21
- */
22
- export interface AuthorizationRequest {
23
- /**
24
- * The response type (e.g., 'code', 'token', 'id_token').
25
- */
26
- response_type?: string;
27
- /**
28
- * The client identifier.
29
- */
30
- client_id?: string;
31
- /**
32
- * The redirection URI after authorization.
33
- */
34
- redirect_uri?: string;
35
- /**
36
- * The scope of the access request.
37
- */
38
- scope?: string;
39
- /**
40
- * An unguessable random string to prevent CSRF attacks.
41
- */
42
- state?: string;
43
- /**
44
- * String value used to associate a Client session with an ID Token.
45
- */
46
- nonce?: string;
47
- /**
48
- * How the authorization response should be returned.
49
- */
50
- response_mode?: string;
51
- /**
52
- * Space delimited, case sensitive list of ASCII string values.
53
- */
54
- prompt?: string;
55
- /**
56
- * The allowable elapsed time in seconds since the last time the End-User was actively authenticated.
57
- */
58
- max_age?: number;
59
- /**
60
- * PKCE code challenge.
61
- */
62
- code_challenge?: string;
63
- /**
64
- * PKCE code challenge method.
65
- */
66
- code_challenge_method?: string;
67
- /**
68
- * Additional authorization parameters.
69
- */
70
- [key: string]: any;
71
- }
72
- /**
73
- * Request configuration for the authorize function.
74
- */
75
- export interface AuthorizeRequestConfig extends Partial<Request> {
76
- url?: string;
77
- /**
78
- * The base URL of the Asgardeo server.
79
- */
80
- baseUrl?: string;
81
- /**
82
- * The authorization request payload.
83
- */
84
- payload: AuthorizationRequest;
85
- }
86
- /**
87
- * Sends an authorization request to the specified OAuth2/OIDC authorization endpoint.
88
- *
89
- * @param requestConfig - Request configuration object containing URL and payload.
90
- * @returns A promise that resolves with the authorization response.
91
- * @throws AsgardeoAPIError when the request fails or URL is invalid.
92
- *
93
- * @example
94
- * ```typescript
95
- * try {
96
- * const authResponse = await initializeApplicationNativeAuthentication({
97
- * url: "https://api.asgardeo.io/t/<ORGANIZATION>/oauth2/authorize",
98
- * payload: {
99
- * response_type: "code",
100
- * client_id: "your-client-id",
101
- * redirect_uri: "https://your-app.com/callback",
102
- * scope: "openid profile email",
103
- * state: "random-state-value",
104
- * code_challenge: "your-pkce-challenge",
105
- * code_challenge_method: "S256"
106
- * }
107
- * });
108
- * console.log(authResponse);
109
- * } catch (error) {
110
- * if (error instanceof AsgardeoAPIError) {
111
- * console.error('Authorization failed:', error.message);
112
- * }
113
- * }
114
- * ```
115
- */
116
- declare const initializeApplicationNativeAuthentication: ({ url, baseUrl, payload, ...requestConfig }: AuthorizeRequestConfig) => Promise<ApplicationNativeAuthenticationInitiateResponse>;
117
- export default initializeApplicationNativeAuthentication;