Private key:
- {openlogin.privKey}
+ {auth.privKey}
diff --git a/examples/react-example/src/index.css b/examples/react-example/src/index.css
index e5d4e469..9c41abb2 100644
--- a/examples/react-example/src/index.css
+++ b/examples/react-example/src/index.css
@@ -45,4 +45,4 @@ button {
background: none;
border-radius: 5px;
cursor: pointer;
-}
\ No newline at end of file
+}
diff --git a/examples/react-example/tsconfig.json b/examples/react-example/tsconfig.json
index 868d474c..3519beee 100644
--- a/examples/react-example/tsconfig.json
+++ b/examples/react-example/tsconfig.json
@@ -1,31 +1,21 @@
{
- "compilerOptions": {
- "target": "es6",
- "module": "esnext",
- "noImplicitAny": true,
- "strictNullChecks": true,
- "strictFunctionTypes": true,
- "strictBindCallApply": true,
- "strictPropertyInitialization": true,
- "noImplicitThis": true,
- "alwaysStrict": true,
- "noUnusedLocals": true,
- "noUnusedParameters": true,
- "noImplicitReturns": true,
- "noFallthroughCasesInSwitch": true,
- "esModuleInterop": true,
- "skipLibCheck": true,
- "forceConsistentCasingInFileNames": true,
- "jsx": "react-jsx",
- "lib": ["dom", "dom.iterable", "esnext"],
- "allowJs": true,
- "allowSyntheticDefaultImports": true,
- "strict": true,
- "moduleResolution": "node",
- "resolveJsonModule": true,
- "isolatedModules": true,
- "noEmit": true
- },
- "include": ["src/**/*"],
- "exclude": ["node_modules", "build"]
+ "compilerOptions": {
+ "target": "ES2020",
+ "useDefineForClassFields": true,
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
+ "module": "NodeNext",
+ "skipLibCheck": true,
+ "moduleResolution": "NodeNext",
+ "allowImportingTsExtensions": true,
+ "isolatedModules": true,
+ "moduleDetection": "force",
+ "noEmit": true,
+ "jsx": "react-jsx",
+ "strict": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "noFallthroughCasesInSwitch": true
+ },
+ "include": ["src/**/*", "vite.config.ts"],
+ "exclude": ["node_modules", "build"]
}
diff --git a/examples/react-example/vite.config.ts b/examples/react-example/vite.config.ts
new file mode 100644
index 00000000..cd4b5780
--- /dev/null
+++ b/examples/react-example/vite.config.ts
@@ -0,0 +1,15 @@
+import react from "@vitejs/plugin-react";
+import { defineConfig } from "vite";
+
+export default defineConfig({
+ server: {
+ port: 3001,
+ },
+ plugins: [react()],
+ build: {
+ sourcemap: true,
+ },
+ define: {
+ global: "globalThis",
+ },
+});
diff --git a/examples/vue-example/src/App.vue b/examples/vue-example/src/App.vue
index c12c8c55..fd71031f 100644
--- a/examples/vue-example/src/App.vue
+++ b/examples/vue-example/src/App.vue
@@ -604,7 +604,7 @@ const openloginInstance = computed(() => {
buildEnv: selectedBuildEnv.value,
sdkUrl: customSdkUrl.value,
mfaSettings: mfaSettings.value,
- sessionTime: 86400,
+ sessionTime: 3600,
includeUserDataInToken: includeUserDataInToken.value,
});
op.init();
@@ -650,17 +650,14 @@ const init = async () => {
openloginInstance.value.options.mfaSettings = mfaSettings.value;
openloginInstance.value.options.includeUserDataInToken = includeUserDataInToken.value;
await openloginInstance.value.init();
- if (openloginInstance.value.state.factorKey) {
- await openloginInstance.value.init();
- }
- if (openloginInstance.value.privKey || openloginInstance.value.state.factorKey || openloginInstance.value.state.walletKey) {
+
+ if (openloginInstance.value.privKey || openloginInstance.value.state.walletKey) {
const startTime = sessionStorage.getItem("startTime");
if (startTime) {
const loginTime = (Date.now() - parseInt(startTime, 10)) / 1000;
console.log("Login time", `${loginTime}s`);
}
- privKey.value =
- openloginInstance.value.privKey || (openloginInstance.value.state.factorKey as string) || (openloginInstance.value.state.walletKey as string);
+ privKey.value = openloginInstance.value.privKey || (openloginInstance.value.state.walletKey as string);
await setProvider(privKey.value);
}
loading.value = false;
diff --git a/examples/vue-example/tsconfig.json b/examples/vue-example/tsconfig.json
index 946784c9..65e7bf5d 100644
--- a/examples/vue-example/tsconfig.json
+++ b/examples/vue-example/tsconfig.json
@@ -1,24 +1,23 @@
{
- "compilerOptions": {
- "target": "esnext",
- "module": "esnext",
- "strict": true,
- "jsx": "preserve",
- "importHelpers": true,
- "moduleResolution": "node",
- "experimentalDecorators": true,
- "skipLibCheck": true,
- "esModuleInterop": true,
- "allowSyntheticDefaultImports": true,
- "resolveJsonModule": true,
- "sourceMap": true,
- "baseUrl": ".",
- "paths": {
- "@/*": ["src/*"]
- },
- "lib": ["esnext", "dom", "dom.iterable", "scripthost"]
+ "compilerOptions": {
+ "target": "esnext",
+ "module": "esnext",
+ "strict": true,
+ "jsx": "preserve",
+ "importHelpers": true,
+ "moduleResolution": "node",
+ "experimentalDecorators": true,
+ "skipLibCheck": true,
+ "esModuleInterop": true,
+ "allowSyntheticDefaultImports": true,
+ "resolveJsonModule": true,
+ "sourceMap": true,
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["src/*"]
},
- "include": ["src/*.vue", "src/*.ts", "src/*.tsx"],
- "exclude": ["node_modules"]
+ "lib": ["esnext", "dom", "dom.iterable", "scripthost"]
+ },
+ "include": ["src/*.vue", "src/*.ts", "src/*.tsx"],
+ "exclude": ["node_modules"]
}
-
\ No newline at end of file
diff --git a/src/core/errors.ts b/src/core/errors.ts
index 343c82f0..9d4806b5 100644
--- a/src/core/errors.ts
+++ b/src/core/errors.ts
@@ -20,7 +20,7 @@ export abstract class AuthError extends Error implements IAuthError {
this.code = code;
this.message = message || "";
// Set name explicitly as minification can mangle class names
- Object.defineProperty(this, "name", { value: "AuthError" });
+ Object.defineProperty(this, "name", { value: "AuthError", configurable: true });
}
toJSON(): IAuthError {
@@ -48,7 +48,7 @@ export class InitializationError extends AuthError {
super(code, message);
// Set name explicitly as minification can mangle class names
- Object.defineProperty(this, "name", { value: "InitializationError" });
+ Object.defineProperty(this, "name", { value: "InitializationError", configurable: true });
}
public static fromCode(code: number, extraMessage = ""): AuthError {
@@ -85,7 +85,7 @@ export class LoginError extends AuthError {
super(code, message);
// Set name explicitly as minification can mangle class names
- Object.defineProperty(this, "name", { value: "LoginError" });
+ Object.defineProperty(this, "name", { value: "LoginError", configurable: true });
}
public static fromCode(code: number, extraMessage = ""): AuthError {