Skip to content

Commit 3621705

Browse files
committed
Downgraded to v7
1 parent c3b2b6b commit 3621705

File tree

3 files changed

+708
-284
lines changed

3 files changed

+708
-284
lines changed

react-native/rn-bare-auth0-example/App.tsx

+13-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as WebBrowser from "@toruslabs/react-native-web-browser";
22
import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider";
3-
import Web3Auth, { ChainNamespace, LOGIN_PROVIDER, WEB3AUTH_NETWORK } from "@web3auth/react-native-sdk";
3+
import Web3Auth, { ChainNamespace, LOGIN_PROVIDER } from "@web3auth/react-native-sdk";
44
import React, { useEffect, useState } from "react";
55
import { Button, Dimensions, ScrollView, StyleSheet, Text, View } from "react-native";
66
import EncryptedStorage from "react-native-encrypted-storage";
@@ -9,8 +9,8 @@ import EncryptedStorage from "react-native-encrypted-storage";
99
import RPC from "./ethersRPC"; // for using ethers.js
1010

1111
const scheme = "web3authrnbareauth0example"; // Or your desired app redirection scheme
12-
const redirectUrl = `${scheme}://auth`;
13-
const clientId = "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ";
12+
const redirectUrl = "web3authrnbareauth0example://auth";
13+
const clientId = "BLQmq83LgX8FRbjPcZ5lVX8EJUjrioOiw3YQd6qCoWs3Of8F2dZRD2nThUSLpbyKO7U3-bXe0D3j8hgjntShi40";
1414

1515
const chainConfig = {
1616
chainNamespace: ChainNamespace.EIP155,
@@ -34,15 +34,15 @@ const ethereumPrivateKeyProvider = new EthereumPrivateKeyProvider({
3434

3535
const web3auth = new Web3Auth(WebBrowser, EncryptedStorage, {
3636
clientId,
37-
network: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET, // or other networks
37+
network: "testnet", // or other networks
3838
redirectUrl,
3939
useCoreKitKey: true,
40-
privateKeyProvider: ethereumPrivateKeyProvider,
4140
loginConfig: {
4241
jwt: {
43-
verifier: "w3a-auth0-demo",
44-
typeOfLogin: "jwt",
45-
clientId: "hUVVf4SEsZT7syOiL0gLU9hFEtm2gQ6O",
42+
verifierSubIdentifier: "google-shubs",
43+
clientId: "1015336103925-reqktqs0ns9vfaeh7nbt8mi634u9157k.apps.googleusercontent.com",
44+
typeOfLogin: "google",
45+
verifier: "google-auth0-gooddollar",
4646
},
4747
},
4848
});
@@ -57,7 +57,8 @@ export default function App() {
5757
// IMP START - SDK Initialization
5858
await web3auth.init();
5959

60-
if (web3auth.connected) {
60+
if (web3auth.privKey) {
61+
await ethereumPrivateKeyProvider.setupProvider(web3auth.privKey);
6162
// IMP END - SDK Initialization
6263
setProvider(ethereumPrivateKeyProvider);
6364
setLoggedIn(true);
@@ -72,14 +73,11 @@ export default function App() {
7273
await web3auth.login({
7374
loginProvider: LOGIN_PROVIDER.JWT,
7475
mfaLevel: "none",
75-
extraLoginOptions: {
76-
domain: "https://web3auth.au.auth0.com",
77-
verifierIdField: "sub",
78-
},
7976
});
8077

8178
uiConsole("Logged In");
82-
if (web3auth.connected) {
79+
if (web3auth.privKey) {
80+
await ethereumPrivateKeyProvider.setupProvider(web3auth.privKey);
8381
// IMP END - Login
8482
setProvider(ethereumPrivateKeyProvider);
8583
uiConsole("Logged In");
@@ -99,7 +97,7 @@ export default function App() {
9997
setConsole("Logging out");
10098
await web3auth.logout();
10199

102-
if (!web3auth.connected) {
100+
if (!web3auth.privKey) {
103101
setProvider(null);
104102
uiConsole("Logged out");
105103
setLoggedIn(false);

0 commit comments

Comments
 (0)