Moralis, Firebase and Magic Wallet Auth

Hi, I’m trying to authenticate in Firebase using Magic Wallet via signInWithMoralis function. But I get Firebase Internal Error. I’ve integrated Metamask, Coinbase Wallet and WalletConnect without problems.
Is this function compatible with the provider generated by Magic? Or is anything extra should I do to work it out?
Thanks

Hey @edumannarino

That should be the case, what error are you receiving? Do you have the logs as Internal Error is very broad

Thanks for answering @YosephKS!
The error information is very poor. Here is a screenshot:
image
To add more info, the pop up for signing the message shows ok but then after signing the error is thrown.

To add more information, I looked at Cloud Logs and found the following:

Unhandled error MoralisError [Moralis SDK Core Error]: [C0006] Request failed, Bad Request(400): Challenge not found, Timeout may have exceeded

Hey @edumannarino

Sorry for the late reply

Are you calling the Challenge API? Looks like if it’s bad request then you are calling the API incorrectly.

I’m using the function signInWithMoralis from @moralisweb3/client-firebase-evm-auth package.

import { signInWithMoralis } from '@moralisweb3/client-firebase-evm-auth'
import { getMoralisAuth } from '@moralisweb3/client-firebase-auth-utils'
import app from '../firebase'

// app is the Firebase App already initalizated
const moralisAuth= getMoralisAuth(app);
// provider is a Web3Provider with signer. 
await signInWithMoralis(moralisAuth, { provider })

This code snippet works fine with Metamask, Coinbase Wallet and Wallet Connect.
The same account with Metamask works fine, but with Magic doesn’t.
I checked the payload and the signature created by magic nad is the same that is created with Metamask.
image

Also checked headers sent and compare the ones sent when using Metamask and Magic and are identical.

So, I don’t really know what could be the problem. Maybe some Firebase configuration?
Any suggestion or comments are more than welcome.
Thanks

I’ve just found the issue. The process to sign the message with Magic Wallet is too long and the challenge expires. I tried doing it very fast and it works. But obviously doesn’t fit for a normal user.
So my question now is: is there any way to configure this expiration time? Or another trick to make it work?
Just to consider that I’m using the function signInWithMoralis from @moralisweb3/client-firebase-evm-auth package.
Thanks again

ahh yes there should be we do have expirationTime or something similar variable to configure that

From here you can see

You can try configure timeout to 120s so it’ll wait 2 minutes instead of default 15

Thank you @YosephKS.
After doing some research, I realised that I must update the Firebase Extension from v0.1.5 to v0.1.6. In that version the timeout is changed from 15 to 60.
But the problem now is that the extension isn’t available on the marketplace, so I can’t update it.

Did it failed to update or something? :thinking:

As far as I know now, we do have a known issue not appearing in the marketplace, but should be available to install the extension from the Firebase CLI

Yes, you’re right. I will update it using CLI.
First I tried to update it in the web console and didn’t find it, so I thought that from CLI would fail too.
Thanks @YosephKS for all your help.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.