1
1
import * as WebBrowser from "@toruslabs/react-native-web-browser" ;
2
2
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" ;
4
4
import React , { useEffect , useState } from "react" ;
5
5
import { Button , Dimensions , ScrollView , StyleSheet , Text , View } from "react-native" ;
6
6
import EncryptedStorage from "react-native-encrypted-storage" ;
@@ -9,8 +9,8 @@ import EncryptedStorage from "react-native-encrypted-storage";
9
9
import RPC from "./ethersRPC" ; // for using ethers.js
10
10
11
11
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 " ;
14
14
15
15
const chainConfig = {
16
16
chainNamespace : ChainNamespace . EIP155 ,
@@ -34,15 +34,15 @@ const ethereumPrivateKeyProvider = new EthereumPrivateKeyProvider({
34
34
35
35
const web3auth = new Web3Auth ( WebBrowser , EncryptedStorage , {
36
36
clientId,
37
- network : WEB3AUTH_NETWORK . SAPPHIRE_MAINNET , // or other networks
37
+ network : "testnet" , // or other networks
38
38
redirectUrl,
39
39
useCoreKitKey : true ,
40
- privateKeyProvider : ethereumPrivateKeyProvider ,
41
40
loginConfig : {
42
41
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" ,
46
46
} ,
47
47
} ,
48
48
} ) ;
@@ -57,7 +57,8 @@ export default function App() {
57
57
// IMP START - SDK Initialization
58
58
await web3auth . init ( ) ;
59
59
60
- if ( web3auth . connected ) {
60
+ if ( web3auth . privKey ) {
61
+ await ethereumPrivateKeyProvider . setupProvider ( web3auth . privKey ) ;
61
62
// IMP END - SDK Initialization
62
63
setProvider ( ethereumPrivateKeyProvider ) ;
63
64
setLoggedIn ( true ) ;
@@ -72,14 +73,11 @@ export default function App() {
72
73
await web3auth . login ( {
73
74
loginProvider : LOGIN_PROVIDER . JWT ,
74
75
mfaLevel : "none" ,
75
- extraLoginOptions : {
76
- domain : "https://web3auth.au.auth0.com" ,
77
- verifierIdField : "sub" ,
78
- } ,
79
76
} ) ;
80
77
81
78
uiConsole ( "Logged In" ) ;
82
- if ( web3auth . connected ) {
79
+ if ( web3auth . privKey ) {
80
+ await ethereumPrivateKeyProvider . setupProvider ( web3auth . privKey ) ;
83
81
// IMP END - Login
84
82
setProvider ( ethereumPrivateKeyProvider ) ;
85
83
uiConsole ( "Logged In" ) ;
@@ -99,7 +97,7 @@ export default function App() {
99
97
setConsole ( "Logging out" ) ;
100
98
await web3auth . logout ( ) ;
101
99
102
- if ( ! web3auth . connected ) {
100
+ if ( ! web3auth . privKey ) {
103
101
setProvider ( null ) ;
104
102
uiConsole ( "Logged out" ) ;
105
103
setLoggedIn ( false ) ;
0 commit comments