Skip to content

Commit a90be9b

Browse files
committed
Update firebase app
1 parent 2d2db17 commit a90be9b

File tree

1 file changed

+22
-5
lines changed
  • custom-authentication/single-connection/firebase-jwt-example/src

1 file changed

+22
-5
lines changed

custom-authentication/single-connection/firebase-jwt-example/src/App.tsx

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,35 @@ function App() {
3838
const idToken = await result.user.getIdToken(true);
3939

4040
connectTo(WALLET_CONNECTORS.AUTH, {
41-
authConnectionId: "w3a-firebase-demo-new",
41+
authConnectionId: "w3a-firebase-demo",
4242
authConnection: AUTH_CONNECTION.CUSTOM,
4343
idToken,
44-
extraLoginOptions: {
45-
isUserIdCaseSensitive: false,
46-
},
4744
});
4845
} catch (error) {
4946
console.error("Firebase authentication error:", error);
5047
}
5148
};
5249

50+
const enableMFAWithIdToken = async () => {
51+
const app = initializeApp(firebaseConfig);
52+
const auth = getAuth(app);
53+
const googleProvider = new GoogleAuthProvider();
54+
55+
const result = await signInWithPopup(auth, googleProvider);
56+
57+
const idToken = await result.user.getIdToken(true);
58+
59+
enableMFA({
60+
authConnectionId: "w3a-firebase-demo",
61+
authConnection: AUTH_CONNECTION.CUSTOM,
62+
idToken,
63+
extraLoginOptions: {
64+
client_id: "BQZ400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
65+
},
66+
});
67+
68+
}
69+
5370
function uiConsole(...args: any[]): void {
5471
const el = document.querySelector("#console>p");
5572
if (el) {
@@ -76,7 +93,7 @@ function App() {
7693
{disconnectError && <div className="error">{disconnectError.message}</div>}
7794
</div>
7895
<div>
79-
<button onClick={() => enableMFA()} className="card">
96+
<button onClick={() => enableMFAWithIdToken()} className="card">
8097
Enable MFA
8198
</button>
8299
{enableMFALoading && <div className="loading">Enabling MFA...</div>}

0 commit comments

Comments
 (0)