@asgardeo/javascript 0.1.20 → 0.1.22
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/AsgardeoJavaScriptClient.d.ts +1 -0
- package/dist/__legacy__/models/client-config.d.ts +1 -1
- package/dist/api/v2/executeEmbeddedSignInFlowV2.d.ts +20 -0
- package/dist/cjs/index.js +293 -70
- package/dist/cjs/index.js.map +4 -4
- package/dist/index.d.ts +4 -0
- package/dist/index.js +288 -70
- package/dist/index.js.map +4 -4
- package/dist/models/client.d.ts +19 -0
- package/dist/models/config.d.ts +7 -0
- package/dist/models/embedded-flow.d.ts +1 -0
- package/dist/models/platforms.d.ts +2 -0
- package/dist/models/v2/embedded-signin-flow-v2.d.ts +78 -0
- package/dist/theme/createTheme.d.ts +1 -17
- package/dist/utils/arrayBufferToBase64url.d.ts +48 -0
- package/dist/utils/base64urlToArrayBuffer.d.ts +55 -0
- package/dist/utils/deriveOrganizationHandleFromBaseUrl.d.ts +3 -3
- package/package.json +2 -2
|
@@ -53,5 +53,6 @@ declare abstract class AsgardeoJavaScriptClient<T = Config> implements AsgardeoC
|
|
|
53
53
|
abstract signUp(payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse>;
|
|
54
54
|
abstract signUp(payload?: unknown): Promise<void> | Promise<EmbeddedFlowExecuteResponse>;
|
|
55
55
|
abstract getAccessToken(sessionId?: string): Promise<string>;
|
|
56
|
+
abstract clearSession(sessionId?: string): void;
|
|
56
57
|
}
|
|
57
58
|
export default AsgardeoJavaScriptClient;
|
|
@@ -0,0 +1,20 @@
|
|
|
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 { EmbeddedFlowExecuteRequestConfigV2, EmbeddedSignInFlowResponseV2 } from '../../models/v2/embedded-signin-flow-v2';
|
|
19
|
+
declare const executeEmbeddedSignInFlowV2: ({ url, baseUrl, payload, sessionDataKey, ...requestConfig }: EmbeddedFlowExecuteRequestConfigV2) => Promise<EmbeddedSignInFlowResponseV2>;
|
|
20
|
+
export default executeEmbeddedSignInFlowV2;
|
package/dist/cjs/index.js
CHANGED
|
@@ -37,8 +37,10 @@ __export(index_exports, {
|
|
|
37
37
|
EmbeddedSignInFlowAuthenticatorParamType: () => EmbeddedSignInFlowAuthenticatorParamType,
|
|
38
38
|
EmbeddedSignInFlowAuthenticatorPromptType: () => EmbeddedSignInFlowAuthenticatorPromptType,
|
|
39
39
|
EmbeddedSignInFlowStatus: () => EmbeddedSignInFlowStatus,
|
|
40
|
+
EmbeddedSignInFlowStatusV2: () => EmbeddedSignInFlowStatusV2,
|
|
40
41
|
EmbeddedSignInFlowStepType: () => EmbeddedSignInFlowStepType,
|
|
41
42
|
EmbeddedSignInFlowType: () => EmbeddedSignInFlowType,
|
|
43
|
+
EmbeddedSignInFlowTypeV2: () => EmbeddedSignInFlowTypeV2,
|
|
42
44
|
FieldType: () => FieldType,
|
|
43
45
|
FlowMode: () => FlowMode,
|
|
44
46
|
IsomorphicCrypto: () => IsomorphicCrypto,
|
|
@@ -48,6 +50,8 @@ __export(index_exports, {
|
|
|
48
50
|
TokenConstants: () => TokenConstants_default,
|
|
49
51
|
VendorConstants: () => VendorConstants_default,
|
|
50
52
|
WellKnownSchemaIds: () => WellKnownSchemaIds,
|
|
53
|
+
arrayBufferToBase64url: () => arrayBufferToBase64url_default,
|
|
54
|
+
base64urlToArrayBuffer: () => base64urlToArrayBuffer_default,
|
|
51
55
|
bem: () => bem_default,
|
|
52
56
|
configureLogger: () => configure,
|
|
53
57
|
createComponentLogger: () => createComponentLogger,
|
|
@@ -62,6 +66,7 @@ __export(index_exports, {
|
|
|
62
66
|
deriveOrganizationHandleFromBaseUrl: () => deriveOrganizationHandleFromBaseUrl_default,
|
|
63
67
|
error: () => error,
|
|
64
68
|
executeEmbeddedSignInFlow: () => executeEmbeddedSignInFlow_default,
|
|
69
|
+
executeEmbeddedSignInFlowV2: () => executeEmbeddedSignInFlowV2_default,
|
|
65
70
|
executeEmbeddedSignUpFlow: () => executeEmbeddedSignUpFlow_default,
|
|
66
71
|
extractPkceStorageKeyFromState: () => extractPkceStorageKeyFromState_default,
|
|
67
72
|
extractUserClaimsFromIdToken: () => extractUserClaimsFromIdToken_default,
|
|
@@ -2026,6 +2031,17 @@ var initializeEmbeddedSignInFlow = async ({
|
|
|
2026
2031
|
payload,
|
|
2027
2032
|
...requestConfig
|
|
2028
2033
|
}) => {
|
|
2034
|
+
try {
|
|
2035
|
+
new URL(url ?? baseUrl);
|
|
2036
|
+
} catch (error2) {
|
|
2037
|
+
throw new AsgardeoAPIError(
|
|
2038
|
+
`Invalid URL provided. ${error2?.toString()}`,
|
|
2039
|
+
"getSchemas-ValidationError-001",
|
|
2040
|
+
"javascript",
|
|
2041
|
+
400,
|
|
2042
|
+
"The provided `url` or `baseUrl` path does not adhere to the URL schema."
|
|
2043
|
+
);
|
|
2044
|
+
}
|
|
2029
2045
|
if (!payload) {
|
|
2030
2046
|
throw new AsgardeoAPIError(
|
|
2031
2047
|
"Authorization payload is required",
|
|
@@ -2041,27 +2057,40 @@ var initializeEmbeddedSignInFlow = async ({
|
|
|
2041
2057
|
searchParams.append(key, String(value));
|
|
2042
2058
|
}
|
|
2043
2059
|
});
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2060
|
+
try {
|
|
2061
|
+
const response = await fetch(url ?? `${baseUrl}/oauth2/authorize`, {
|
|
2062
|
+
...requestConfig,
|
|
2063
|
+
method: requestConfig.method || "POST",
|
|
2064
|
+
headers: {
|
|
2065
|
+
...requestConfig.headers,
|
|
2066
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
2067
|
+
Accept: "application/json"
|
|
2068
|
+
},
|
|
2069
|
+
body: searchParams.toString()
|
|
2070
|
+
});
|
|
2071
|
+
if (!response.ok) {
|
|
2072
|
+
const errorText = await response.text();
|
|
2073
|
+
throw new AsgardeoAPIError(
|
|
2074
|
+
`Authorization request failed: ${errorText}`,
|
|
2075
|
+
"initializeEmbeddedSignInFlow-ResponseError-001",
|
|
2076
|
+
"javascript",
|
|
2077
|
+
response.status,
|
|
2078
|
+
response.statusText
|
|
2079
|
+
);
|
|
2080
|
+
}
|
|
2081
|
+
return await response.json();
|
|
2082
|
+
} catch (error2) {
|
|
2083
|
+
if (error2 instanceof AsgardeoAPIError) {
|
|
2084
|
+
throw error2;
|
|
2085
|
+
}
|
|
2056
2086
|
throw new AsgardeoAPIError(
|
|
2057
|
-
`
|
|
2058
|
-
"initializeEmbeddedSignInFlow-
|
|
2087
|
+
`Network or parsing error: ${error2 instanceof Error ? error2.message : "Unknown error"}`,
|
|
2088
|
+
"initializeEmbeddedSignInFlow-NetworkError-001",
|
|
2059
2089
|
"javascript",
|
|
2060
|
-
|
|
2061
|
-
|
|
2090
|
+
0,
|
|
2091
|
+
"Network Error"
|
|
2062
2092
|
);
|
|
2063
2093
|
}
|
|
2064
|
-
return await response.json();
|
|
2065
2094
|
};
|
|
2066
2095
|
var initializeEmbeddedSignInFlow_default = initializeEmbeddedSignInFlow;
|
|
2067
2096
|
|
|
@@ -2072,6 +2101,17 @@ var executeEmbeddedSignInFlow = async ({
|
|
|
2072
2101
|
payload,
|
|
2073
2102
|
...requestConfig
|
|
2074
2103
|
}) => {
|
|
2104
|
+
try {
|
|
2105
|
+
new URL(url ?? baseUrl);
|
|
2106
|
+
} catch (error2) {
|
|
2107
|
+
throw new AsgardeoAPIError(
|
|
2108
|
+
`Invalid URL provided. ${error2?.toString()}`,
|
|
2109
|
+
"executeEmbeddedSignInFlow-ValidationError-001",
|
|
2110
|
+
"javascript",
|
|
2111
|
+
400,
|
|
2112
|
+
"The provided `url` or `baseUrl` path does not adhere to the URL schema."
|
|
2113
|
+
);
|
|
2114
|
+
}
|
|
2075
2115
|
if (!payload) {
|
|
2076
2116
|
throw new AsgardeoAPIError(
|
|
2077
2117
|
"Authorization payload is required",
|
|
@@ -2081,32 +2121,46 @@ var executeEmbeddedSignInFlow = async ({
|
|
|
2081
2121
|
"If an authorization payload is not provided, the request cannot be constructed correctly."
|
|
2082
2122
|
);
|
|
2083
2123
|
}
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2124
|
+
try {
|
|
2125
|
+
const response = await fetch(url ?? `${baseUrl}/oauth2/authn`, {
|
|
2126
|
+
...requestConfig,
|
|
2127
|
+
method: requestConfig.method || "POST",
|
|
2128
|
+
headers: {
|
|
2129
|
+
"Content-Type": "application/json",
|
|
2130
|
+
Accept: "application/json",
|
|
2131
|
+
...requestConfig.headers
|
|
2132
|
+
},
|
|
2133
|
+
body: JSON.stringify(payload)
|
|
2134
|
+
});
|
|
2135
|
+
if (!response.ok) {
|
|
2136
|
+
const errorText = await response.text();
|
|
2137
|
+
throw new AsgardeoAPIError(
|
|
2138
|
+
`Authorization request failed: ${errorText}`,
|
|
2139
|
+
"initializeEmbeddedSignInFlow-ResponseError-001",
|
|
2140
|
+
"javascript",
|
|
2141
|
+
response.status,
|
|
2142
|
+
response.statusText
|
|
2143
|
+
);
|
|
2144
|
+
}
|
|
2145
|
+
return await response.json();
|
|
2146
|
+
} catch (error2) {
|
|
2147
|
+
if (error2 instanceof AsgardeoAPIError) {
|
|
2148
|
+
throw error2;
|
|
2149
|
+
}
|
|
2096
2150
|
throw new AsgardeoAPIError(
|
|
2097
|
-
`
|
|
2098
|
-
"
|
|
2151
|
+
`Network or parsing error: ${error2 instanceof Error ? error2.message : "Unknown error"}`,
|
|
2152
|
+
"executeEmbeddedSignInFlow-NetworkError-001",
|
|
2099
2153
|
"javascript",
|
|
2100
|
-
|
|
2101
|
-
|
|
2154
|
+
0,
|
|
2155
|
+
"Network Error"
|
|
2102
2156
|
);
|
|
2103
2157
|
}
|
|
2104
|
-
return await response.json();
|
|
2105
2158
|
};
|
|
2106
2159
|
var executeEmbeddedSignInFlow_default = executeEmbeddedSignInFlow;
|
|
2107
2160
|
|
|
2108
2161
|
// src/models/embedded-flow.ts
|
|
2109
2162
|
var EmbeddedFlowType = /* @__PURE__ */ ((EmbeddedFlowType2) => {
|
|
2163
|
+
EmbeddedFlowType2["Authentication"] = "AUTHENTICATION";
|
|
2110
2164
|
EmbeddedFlowType2["Registration"] = "REGISTRATION";
|
|
2111
2165
|
return EmbeddedFlowType2;
|
|
2112
2166
|
})(EmbeddedFlowType || {});
|
|
@@ -2149,30 +2203,54 @@ var executeEmbeddedSignUpFlow = async ({
|
|
|
2149
2203
|
"At least one of the baseUrl or url must be provided to execute the embedded sign up flow."
|
|
2150
2204
|
);
|
|
2151
2205
|
}
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
headers: {
|
|
2156
|
-
"Content-Type": "application/json",
|
|
2157
|
-
Accept: "application/json",
|
|
2158
|
-
...requestConfig.headers
|
|
2159
|
-
},
|
|
2160
|
-
body: JSON.stringify({
|
|
2161
|
-
...payload ?? {},
|
|
2162
|
-
flowType: "REGISTRATION" /* Registration */
|
|
2163
|
-
})
|
|
2164
|
-
});
|
|
2165
|
-
if (!response.ok) {
|
|
2166
|
-
const errorText = await response.text();
|
|
2206
|
+
try {
|
|
2207
|
+
new URL(url ?? baseUrl);
|
|
2208
|
+
} catch (error2) {
|
|
2167
2209
|
throw new AsgardeoAPIError(
|
|
2168
|
-
`
|
|
2169
|
-
"
|
|
2210
|
+
`Invalid URL provided. ${error2?.toString()}`,
|
|
2211
|
+
"executeEmbeddedSignUpFlow-ValidationError-001",
|
|
2170
2212
|
"javascript",
|
|
2171
|
-
|
|
2172
|
-
|
|
2213
|
+
400,
|
|
2214
|
+
"The provided `url` or `baseUrl` path does not adhere to the URL schema."
|
|
2215
|
+
);
|
|
2216
|
+
}
|
|
2217
|
+
try {
|
|
2218
|
+
const response = await fetch(url ?? `${baseUrl}/api/server/v1/flow/execute`, {
|
|
2219
|
+
...requestConfig,
|
|
2220
|
+
method: requestConfig.method || "POST",
|
|
2221
|
+
headers: {
|
|
2222
|
+
"Content-Type": "application/json",
|
|
2223
|
+
Accept: "application/json",
|
|
2224
|
+
...requestConfig.headers
|
|
2225
|
+
},
|
|
2226
|
+
body: JSON.stringify({
|
|
2227
|
+
...payload ?? {},
|
|
2228
|
+
flowType: "REGISTRATION" /* Registration */
|
|
2229
|
+
})
|
|
2230
|
+
});
|
|
2231
|
+
if (!response.ok) {
|
|
2232
|
+
const errorText = await response.text();
|
|
2233
|
+
throw new AsgardeoAPIError(
|
|
2234
|
+
`Embedded SignUp flow execution failed: ${errorText}`,
|
|
2235
|
+
"javascript-executeEmbeddedSignUpFlow-ResponseError-100",
|
|
2236
|
+
"javascript",
|
|
2237
|
+
response.status,
|
|
2238
|
+
response.statusText
|
|
2239
|
+
);
|
|
2240
|
+
}
|
|
2241
|
+
return await response.json();
|
|
2242
|
+
} catch (error2) {
|
|
2243
|
+
if (error2 instanceof AsgardeoAPIError) {
|
|
2244
|
+
throw error2;
|
|
2245
|
+
}
|
|
2246
|
+
throw new AsgardeoAPIError(
|
|
2247
|
+
`Network or parsing error: ${error2 instanceof Error ? error2.message : "Unknown error"}`,
|
|
2248
|
+
"executeEmbeddedSignUpFlow-NetworkError-001",
|
|
2249
|
+
"javascript",
|
|
2250
|
+
0,
|
|
2251
|
+
"Network Error"
|
|
2173
2252
|
);
|
|
2174
2253
|
}
|
|
2175
|
-
return await response.json();
|
|
2176
2254
|
};
|
|
2177
2255
|
var executeEmbeddedSignUpFlow_default = executeEmbeddedSignUpFlow;
|
|
2178
2256
|
|
|
@@ -2189,26 +2267,39 @@ var getUserInfo = async ({ url, ...requestConfig }) => {
|
|
|
2189
2267
|
"Invalid Request"
|
|
2190
2268
|
);
|
|
2191
2269
|
}
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2270
|
+
try {
|
|
2271
|
+
const response = await fetch(url, {
|
|
2272
|
+
...requestConfig,
|
|
2273
|
+
method: "GET",
|
|
2274
|
+
headers: {
|
|
2275
|
+
"Content-Type": "application/json",
|
|
2276
|
+
Accept: "application/json",
|
|
2277
|
+
...requestConfig.headers
|
|
2278
|
+
}
|
|
2279
|
+
});
|
|
2280
|
+
if (!response.ok) {
|
|
2281
|
+
const errorText = await response.text();
|
|
2282
|
+
throw new AsgardeoAPIError(
|
|
2283
|
+
`Failed to fetch user info: ${errorText}`,
|
|
2284
|
+
"getUserInfo-ResponseError-001",
|
|
2285
|
+
"javascript",
|
|
2286
|
+
response.status,
|
|
2287
|
+
response.statusText
|
|
2288
|
+
);
|
|
2289
|
+
}
|
|
2290
|
+
return await response.json();
|
|
2291
|
+
} catch (error2) {
|
|
2292
|
+
if (error2 instanceof AsgardeoAPIError) {
|
|
2293
|
+
throw error2;
|
|
2199
2294
|
}
|
|
2200
|
-
});
|
|
2201
|
-
if (!response.ok) {
|
|
2202
|
-
const errorText = await response.text();
|
|
2203
2295
|
throw new AsgardeoAPIError(
|
|
2204
|
-
`
|
|
2205
|
-
"getUserInfo-
|
|
2296
|
+
`Network or parsing error: ${error2 instanceof Error ? error2.message : "Unknown error"}`,
|
|
2297
|
+
"getUserInfo-NetworkError-001",
|
|
2206
2298
|
"javascript",
|
|
2207
|
-
|
|
2208
|
-
|
|
2299
|
+
0,
|
|
2300
|
+
"Network Error"
|
|
2209
2301
|
);
|
|
2210
2302
|
}
|
|
2211
|
-
return await response.json();
|
|
2212
2303
|
};
|
|
2213
2304
|
var getUserInfo_default = getUserInfo;
|
|
2214
2305
|
|
|
@@ -2876,6 +2967,102 @@ var getBrandingPreference = async ({
|
|
|
2876
2967
|
};
|
|
2877
2968
|
var getBrandingPreference_default = getBrandingPreference;
|
|
2878
2969
|
|
|
2970
|
+
// src/models/v2/embedded-signin-flow-v2.ts
|
|
2971
|
+
var EmbeddedSignInFlowStatusV2 = /* @__PURE__ */ ((EmbeddedSignInFlowStatusV22) => {
|
|
2972
|
+
EmbeddedSignInFlowStatusV22["Complete"] = "COMPLETE";
|
|
2973
|
+
EmbeddedSignInFlowStatusV22["Incomplete"] = "INCOMPLETE";
|
|
2974
|
+
EmbeddedSignInFlowStatusV22["Error"] = "ERROR";
|
|
2975
|
+
return EmbeddedSignInFlowStatusV22;
|
|
2976
|
+
})(EmbeddedSignInFlowStatusV2 || {});
|
|
2977
|
+
var EmbeddedSignInFlowTypeV2 = /* @__PURE__ */ ((EmbeddedSignInFlowTypeV22) => {
|
|
2978
|
+
EmbeddedSignInFlowTypeV22["Redirection"] = "REDIRECTION";
|
|
2979
|
+
EmbeddedSignInFlowTypeV22["View"] = "VIEW";
|
|
2980
|
+
return EmbeddedSignInFlowTypeV22;
|
|
2981
|
+
})(EmbeddedSignInFlowTypeV2 || {});
|
|
2982
|
+
|
|
2983
|
+
// src/api/v2/executeEmbeddedSignInFlowV2.ts
|
|
2984
|
+
var executeEmbeddedSignInFlowV2 = async ({
|
|
2985
|
+
url,
|
|
2986
|
+
baseUrl,
|
|
2987
|
+
payload,
|
|
2988
|
+
sessionDataKey,
|
|
2989
|
+
...requestConfig
|
|
2990
|
+
}) => {
|
|
2991
|
+
if (!payload) {
|
|
2992
|
+
throw new AsgardeoAPIError(
|
|
2993
|
+
"Authorization payload is required",
|
|
2994
|
+
"executeEmbeddedSignInFlow-ValidationError-002",
|
|
2995
|
+
"javascript",
|
|
2996
|
+
400,
|
|
2997
|
+
"If an authorization payload is not provided, the request cannot be constructed correctly."
|
|
2998
|
+
);
|
|
2999
|
+
}
|
|
3000
|
+
let endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
3001
|
+
const response = await fetch(endpoint, {
|
|
3002
|
+
...requestConfig,
|
|
3003
|
+
method: requestConfig.method || "POST",
|
|
3004
|
+
headers: {
|
|
3005
|
+
"Content-Type": "application/json",
|
|
3006
|
+
Accept: "application/json",
|
|
3007
|
+
...requestConfig.headers
|
|
3008
|
+
},
|
|
3009
|
+
body: JSON.stringify(payload)
|
|
3010
|
+
});
|
|
3011
|
+
if (!response.ok) {
|
|
3012
|
+
const errorText = await response.text();
|
|
3013
|
+
throw new AsgardeoAPIError(
|
|
3014
|
+
`Authorization request failed: ${errorText}`,
|
|
3015
|
+
"executeEmbeddedSignInFlow-ResponseError-001",
|
|
3016
|
+
"javascript",
|
|
3017
|
+
response.status,
|
|
3018
|
+
response.statusText
|
|
3019
|
+
);
|
|
3020
|
+
}
|
|
3021
|
+
const flowResponse = await response.json();
|
|
3022
|
+
if (flowResponse.flowStatus === "COMPLETE" /* Complete */ && flowResponse.assertion && sessionDataKey) {
|
|
3023
|
+
try {
|
|
3024
|
+
const oauth2Response = await fetch(`${baseUrl}/oauth2/authorize`, {
|
|
3025
|
+
method: "POST",
|
|
3026
|
+
headers: {
|
|
3027
|
+
"Content-Type": "application/json",
|
|
3028
|
+
Accept: "application/json",
|
|
3029
|
+
...requestConfig.headers
|
|
3030
|
+
},
|
|
3031
|
+
body: JSON.stringify({
|
|
3032
|
+
assertion: flowResponse.assertion,
|
|
3033
|
+
sessionDataKey
|
|
3034
|
+
}),
|
|
3035
|
+
credentials: "include"
|
|
3036
|
+
});
|
|
3037
|
+
if (!oauth2Response.ok) {
|
|
3038
|
+
const oauth2ErrorText = await oauth2Response.text();
|
|
3039
|
+
throw new AsgardeoAPIError(
|
|
3040
|
+
`OAuth2 authorization failed: ${oauth2ErrorText}`,
|
|
3041
|
+
"executeEmbeddedSignInFlow-OAuth2Error-002",
|
|
3042
|
+
"javascript",
|
|
3043
|
+
oauth2Response.status,
|
|
3044
|
+
oauth2Response.statusText
|
|
3045
|
+
);
|
|
3046
|
+
}
|
|
3047
|
+
const oauth2Result = await oauth2Response.json();
|
|
3048
|
+
return {
|
|
3049
|
+
flowStatus: flowResponse.flowStatus,
|
|
3050
|
+
redirectUrl: oauth2Result.redirect_uri
|
|
3051
|
+
};
|
|
3052
|
+
} catch (authError) {
|
|
3053
|
+
throw new AsgardeoAPIError(
|
|
3054
|
+
`OAuth2 authorization failed: ${authError instanceof Error ? authError.message : "Unknown error"}`,
|
|
3055
|
+
"executeEmbeddedSignInFlow-OAuth2Error-001",
|
|
3056
|
+
"javascript",
|
|
3057
|
+
500,
|
|
3058
|
+
"Failed to complete OAuth2 authorization after successful embedded sign-in flow."
|
|
3059
|
+
);
|
|
3060
|
+
}
|
|
3061
|
+
}
|
|
3062
|
+
return flowResponse;
|
|
3063
|
+
};
|
|
3064
|
+
var executeEmbeddedSignInFlowV2_default = executeEmbeddedSignInFlowV2;
|
|
3065
|
+
|
|
2879
3066
|
// src/constants/ApplicationNativeAuthenticationConstants.ts
|
|
2880
3067
|
var ApplicationNativeAuthenticationConstants = {
|
|
2881
3068
|
SupportedAuthenticators: {
|
|
@@ -2910,6 +3097,7 @@ var VendorConstants_default = VendorConstants;
|
|
|
2910
3097
|
var Platform = /* @__PURE__ */ ((Platform2) => {
|
|
2911
3098
|
Platform2["Asgardeo"] = "ASGARDEO";
|
|
2912
3099
|
Platform2["IdentityServer"] = "IDENTITY_SERVER";
|
|
3100
|
+
Platform2["AsgardeoV2"] = "AsgardeoV2";
|
|
2913
3101
|
Platform2["Unknown"] = "UNKNOWN";
|
|
2914
3102
|
return Platform2;
|
|
2915
3103
|
})(Platform || {});
|
|
@@ -3564,6 +3752,30 @@ var createTheme = (config = {}, isDark = false) => {
|
|
|
3564
3752
|
var DEFAULT_THEME = "light";
|
|
3565
3753
|
var createTheme_default = createTheme;
|
|
3566
3754
|
|
|
3755
|
+
// src/utils/arrayBufferToBase64url.ts
|
|
3756
|
+
var arrayBufferToBase64url = (buffer) => {
|
|
3757
|
+
const bytes = new Uint8Array(buffer);
|
|
3758
|
+
let binary = "";
|
|
3759
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
3760
|
+
binary += String.fromCharCode(bytes[i]);
|
|
3761
|
+
}
|
|
3762
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
3763
|
+
};
|
|
3764
|
+
var arrayBufferToBase64url_default = arrayBufferToBase64url;
|
|
3765
|
+
|
|
3766
|
+
// src/utils/base64urlToArrayBuffer.ts
|
|
3767
|
+
var base64urlToArrayBuffer = (base64url) => {
|
|
3768
|
+
const padding = "=".repeat((4 - base64url.length % 4) % 4);
|
|
3769
|
+
const base64 = base64url.replace(/-/g, "+").replace(/_/g, "/") + padding;
|
|
3770
|
+
const binaryString = atob(base64);
|
|
3771
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
3772
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
3773
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
3774
|
+
}
|
|
3775
|
+
return bytes.buffer;
|
|
3776
|
+
};
|
|
3777
|
+
var base64urlToArrayBuffer_default = base64urlToArrayBuffer;
|
|
3778
|
+
|
|
3567
3779
|
// src/utils/bem.ts
|
|
3568
3780
|
var bem = (baseClass, element, modifier) => {
|
|
3569
3781
|
let className = baseClass;
|
|
@@ -3703,6 +3915,12 @@ var BROWSER_STYLES = {
|
|
|
3703
3915
|
prefix: "color: #7c3aed; font-weight: bold;",
|
|
3704
3916
|
timestamp: "color: #6b7280; font-size: 0.9em;"
|
|
3705
3917
|
};
|
|
3918
|
+
var LOG_LEVEL_ORDER = {
|
|
3919
|
+
debug: 0,
|
|
3920
|
+
info: 1,
|
|
3921
|
+
warn: 2,
|
|
3922
|
+
error: 3
|
|
3923
|
+
};
|
|
3706
3924
|
var Logger = class _Logger {
|
|
3707
3925
|
constructor(config = {}) {
|
|
3708
3926
|
__publicField(this, "config");
|
|
@@ -3724,7 +3942,7 @@ var Logger = class _Logger {
|
|
|
3724
3942
|
* Check if a log level should be output
|
|
3725
3943
|
*/
|
|
3726
3944
|
shouldLog(level) {
|
|
3727
|
-
return level >= this.config.level;
|
|
3945
|
+
return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];
|
|
3728
3946
|
}
|
|
3729
3947
|
/**
|
|
3730
3948
|
* Get timestamp string
|
|
@@ -4412,8 +4630,10 @@ var transformBrandingPreferenceToTheme_default = transformBrandingPreferenceToTh
|
|
|
4412
4630
|
EmbeddedSignInFlowAuthenticatorParamType,
|
|
4413
4631
|
EmbeddedSignInFlowAuthenticatorPromptType,
|
|
4414
4632
|
EmbeddedSignInFlowStatus,
|
|
4633
|
+
EmbeddedSignInFlowStatusV2,
|
|
4415
4634
|
EmbeddedSignInFlowStepType,
|
|
4416
4635
|
EmbeddedSignInFlowType,
|
|
4636
|
+
EmbeddedSignInFlowTypeV2,
|
|
4417
4637
|
FieldType,
|
|
4418
4638
|
FlowMode,
|
|
4419
4639
|
IsomorphicCrypto,
|
|
@@ -4423,6 +4643,8 @@ var transformBrandingPreferenceToTheme_default = transformBrandingPreferenceToTh
|
|
|
4423
4643
|
TokenConstants,
|
|
4424
4644
|
VendorConstants,
|
|
4425
4645
|
WellKnownSchemaIds,
|
|
4646
|
+
arrayBufferToBase64url,
|
|
4647
|
+
base64urlToArrayBuffer,
|
|
4426
4648
|
bem,
|
|
4427
4649
|
configureLogger,
|
|
4428
4650
|
createComponentLogger,
|
|
@@ -4437,6 +4659,7 @@ var transformBrandingPreferenceToTheme_default = transformBrandingPreferenceToTh
|
|
|
4437
4659
|
deriveOrganizationHandleFromBaseUrl,
|
|
4438
4660
|
error,
|
|
4439
4661
|
executeEmbeddedSignInFlow,
|
|
4662
|
+
executeEmbeddedSignInFlowV2,
|
|
4440
4663
|
executeEmbeddedSignUpFlow,
|
|
4441
4664
|
extractPkceStorageKeyFromState,
|
|
4442
4665
|
extractUserClaimsFromIdToken,
|