I tried to use authentication custom with magic.link in react native app. I get authorized in magic link, then i get message result and after that I try to authenticate and got error.
Log and error:
[Thu Jan 05 2023 01:30:39.210] LOG [Error: Non ethereum enabled browser]
[Thu Jan 05 2023 01:30:39.559] LOG step 1, isLoggedIn: false
[Thu Jan 05 2023 01:30:56.605] LOG step 2: WyIweDc5M2M1MTU3NWQxNmZjMDM4YTFiOTQxZWExZmNiOGQ0ODhkZDE0OTUyMmM1ZGI4MmE3MDBkZDNjNmJmNjJiNWE3ODc0NTBhMmI2NDdlMTEyNjgzZTg0OWZhOGIwZWUxNmQwZmY3NmEwNDFjOThjYzVmNjEyNTljN2NlNjllMDU5MWIiLCJ7XCJpYXRcIjoxNjcyODcxNDU1LFwiZXh0XCI6MTY3Mjg3MjM1NSxcImlzc1wiOlwiZGlkOmV0aHI6MHhGQ0MyY2MyN0QwNWY1MEI0NjREQkJGRkE2MDVmNDM4ZTNiYjAzNTJGXCIsXCJzdWJcIjpcIlRYaGF2TlZaX2JLT1Zna0ltNlFiR
[Thu Jan 05 2023 01:30:56.774] LOG step 3, address: 0xfcc23c27d05f50b464dbbffa6dasd123
[Thu Jan 05 2023 01:30:57.220] LOG [Error: Non ethereum enabled browser]
Code:
Moralis.enableWeb3({
throwOnError: true,
provider: āmagicLinkā,
}).then((e) => console.log(e))
.catch((e) => console.log(e));
Magic.user.isLoggedIn().then(isLoggedIn => {
console.log("step 1, isLoggedIn: " + isLoggedIn);
if (isLoggedIn) {
successCallback();
} else {
confirmCallback();
Magic.auth.loginWithMagicLink({
email: email,
showUI: false
}).then(Ā® => {
console.log("step 2: " + r);
Magic.user.getMetadata().then(async m => {
let address = m.publicAddress;
let chainId = ā0x38ā;
console.log("step 3, address: " + address);
// Get message to sign from the auth api
const {message} = await Moralis.Cloud.run(ārequestMessageā, {
address: address,
chain: parseInt(chainId, 16),
network: āevmā,
});
// Authenticate and login via parse
Moralis.authenticate({
signingMessage: message,
throwOnError: true,
}).then(e => console.log(e))
.catch(e => console.log(e));
});
});
}
}).catch((e) => {
console.log(e);
errorCallback();
});