React Native + Firebase Integration With Web3Auth #547
Tguntenaar
announced in
Help
Replies: 3 comments 4 replies
-
Hey @Tguntenaar Have you tried This could be achieved by using web3auth.login({
loginProvider: LoginProvider.JWT,
redirectUrl: resolvedRedirectUrl,
extraLoginOptions: {
id_token: "your JWT token",
},
}); |
Beta Was this translation helpful? Give feedback.
1 reply
-
For people also looking into integrating firebase with the import auth from 'firebase/auth';
import Web3Auth, {
LOGIN_PROVIDER,
OPENLOGIN_NETWORK,
} from '@web3auth/react-native-sdk';
import * as WebBrowser from '@toruslabs/react-native-web-browser';
import {
GoogleSignin,
statusCodes,
} from '@react-native-google-signin/google-signin';
// Sign in with Google
await GoogleSignin.hasPlayServices();
const userInfo = await GoogleSignin.signIn();
const { idToken } = userInfo;
// Sign in with Firebase
const googleCredential = GoogleAuthProvider.credential(idToken);
signInWithCredential(auth, googleCredential);
const web3auth = new Web3Auth(WebBrowser, {
clientId: clientIdWeb3Auth,
network: OPENLOGIN_NETWORK.TESTNET,
});
const scheme = 'YOUR_SCHEME'; // Or your desired app redirection scheme
const resolvedRedirectUrl = `${scheme}://openlogin`;
const clientIdWeb3Auth = 'YOUR_CLIENT_ID';
// Sign in with web3auth
const state = await web3auth.login({
loginProvider: LOGIN_PROVIDER.JWT,
redirectUrl: resolvedRedirectUrl,
extraLoginOptions: {
id_token: idToken,
verifierIdField: 'sub', // same as your JWT Verifier ID
},
}); |
Beta Was this translation helpful? Give feedback.
3 replies
-
Hello @Tguntenaar, I just try your codes, but it does not work at my side. Did you config verifier anywhere? Thanks, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I followed this tutorial: React Native Web3Auth. I did manage to login with and retrieve a private key etc. Now I would to integrate web3auth with Firebase. However this specific tutorial isn't for React Native but for Firebase for the web. In React Native
signInWithPopup(auth, googleProvider)
does not work. Do you guys have a working example of such integration?Extra info
In the firebase docs it says that on mobile devices instead of signInWithPopup siginInWithRedirect is preferred.
Beta Was this translation helpful? Give feedback.
All reactions