magic-js icon indicating copy to clipboard operation
magic-js copied to clipboard

Why do I get a Magic Extension Error (oauth): [Cannot read property 'openAuth' of null] An error has occurred

Open AB7zz opened this issue 1 year ago • 4 comments

✅ Prerequisites

  • [✅ ] Did you perform a cursory search of open issues? Is this question already asked elsewhere?
  • [✅] Are you reporting to the correct repository (magic-sdk)?

❓ Question

I've initialized a magic instance as in the docs

const magic = new Magic(MAGIC_PUBLISHABLE_KEY, {
        network: {
            rpcUrl: RPC_URL_DEV,
            chainId: CHAIN_ID
        },
        extensions: [
            new OAuthExtension()
        ]
    });
const handleSocialMediaLogin = async (provider, redirectUri) => {

        try {
            setLoading(true);
            setError(null);
              const result = await magic.oauth.loginWithPopup({
                provider,
                redirectUri
              });
              console.log('OAuth login result:', result);

            setLoading(false);
        } catch (error) {
            setLoading(false);
            console.error('OAuth login error:', error);
            setError(`Error logging in with ${provider}: ${error.message}`);
        }
    }

and when I try to login using any social media, I get a OAuth login error saying "Magic Extension Error (oauth): [Cannot read property 'openAuth' of null] An error has occurred". Not sure why when I've followed everything as in the docs. I even have a dedicated wallet. Sign in with email works perfectly fine.

🌎 Environment

Software Version(s)
magic-sdk 13.6.2
Mobile iPhone
npm 10.9.0
Operating System iOS

AB7zz avatar Oct 21 '24 03:10 AB7zz