Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code confirmation modal not appearing on android #853

Open
3 tasks done
nadsonfernando opened this issue Feb 25, 2025 · 7 comments
Open
3 tasks done

Code confirmation modal not appearing on android #853

nadsonfernando opened this issue Feb 25, 2025 · 7 comments

Comments

@nadsonfernando
Copy link

nadsonfernando commented Feb 25, 2025

βœ… Prerequisites

  • Did you perform a cursory search of open issues? Is this bug already reported elsewhere?
  • Are you running the latest SDK version?
  • Are you reporting to the correct repository (magic-sdk)?

πŸ› Description

Only on Android when calling the loginWithMagicLink method, the webView with the confirmation code is not shown on the screen. When inspecting the component tree, I noticed that there is a zINdex: -1000, if I manually change it through devTools to a value of 0 this is shown.

πŸ€” Expected behavior

The magic link confirmation modal should appear, but on Android it doesn't appear.

πŸ’» Code Sample

const { auth, user, Relayer } = new Magic(Key, {
  extensions: [new OAuthExtension(), new AuthExtension()],
});

export class AuthMagicLinkProvider {
  static Relayer = Relayer;

  static async login(email: string) {
    try {
      const didToken = await auth.loginWithMagicLink({ email, showUI: true });

      return { didToken };
    } catch (error) {
      return { error };
    }
  }

  static isLoggedIn() {
    return user.isLoggedIn();
  }

  static logout() {
    return user.logout();
  }
}

App.tsx
<SafeAreaProvider>
   <AuthMagicLinkProvider.Relayer />
</SafeAreaProvider>

🌎 Environment

Software Version(s)
@magic-ext/auth ^4.3.2
@magic-ext/react-native-bare-oauth ^25.21.0
@magic-sdk/react-native-bare ^29.21.0
react-native 0.77.1
@RodrigoSarmento
Copy link

RodrigoSarmento commented Mar 3, 2025

I'm having the same issue. I can't see any change on the status and modal doesn't show (I have <magic.Relayer /> added).

So for me, it is two issues, modal is not opening, and I can't see any of the handle.on being triggered.

const handleLoginWithEmailOTP = useCallback(
    async (email: string) => {
      try {
        const handle = magic.auth.loginWithEmailOTP({ email });

        handle
          .on('email-otp-sent', () => setStatus('email-otp-sent'))
          .on('invalid-email-otp', () => {
            handle.emit('cancel');
            setStatus('invalid-email-otp');
          })
          .on('done', () => setStatus('done'))
          .on('error', () => setStatus('error'))
          .on('device-verification-email-sent', () =>
            setStatus('device-verification-email-sent'),
          );
      } catch (error) {
        setStatus('error');
        if (error instanceof RPCError) {
          switch (error.code) {
            case RPCErrorCode.AccessDeniedToUser: {
              break; //TODO: Add error handling
            }
          }
        }
      }
    },
    [magic.auth],
  );


```    "react-native": "0.77.1",
    "@magic-sdk/react-native-bare": "^30.0.0",

@joshuascan
Copy link
Member

Hi @nadsonfernando / @RodrigoSarmento ,

Currently looking into this now. I initially was able to reproduce on an android simulator with magic RN bare version 29.21.0, but it's now working correctly again. I've also successfully triggered the modal on version 30.0.0. Has it also been inconsistent for either of you, or is it still happening 100% of the time?

Also, @RodrigoSarmento the events are intended to be used with the whitelabel flow so that might be why you aren't seeing any of them. The whitelabel flow would be triggered via the showUI param like this:

const handle = magic.auth.loginWithEmailOTP({ email: "[email protected]", showUI: false, deviceCheckUI: false }).

I'll keep you both posted on a fix for the modal issue. Thanks!

@RodrigoSarmento
Copy link

RodrigoSarmento commented Mar 4, 2025

Hello, I've tried with showUI false as well, although it was working before even with the UI showing. I'm going to try in the sdk 28 and with device check false.

I'm testing on a real device and it was happening 100% of times for sdk 29 and 30(I probably tried 10 times in each)

@RodrigoSarmento
Copy link

RodrigoSarmento commented Mar 5, 2025

Hello. I've just tested with SDK 28, and I still have the same issue.

I'm calling the function with showUI false and deviceCheckUI:false as asked, and I still can't see the events logs.

 const handle = magic.auth.loginWithEmailOTP({
          email,
          showUI: false,
          deviceCheckUI: false,
        });

If I call to show the modal, the modal is still not prompt

  const handle = magic.auth.loginWithEmailOTP({
          email,
        });

If there is anything else I could do or more info I could give to you please let me know

@joshuascan
Copy link
Member

@RodrigoSarmento would you mind sharing your publishable API key with me? This will allow me to take a closer look at our logs to hopefully see what's going on. Feel free to send it to [email protected] if you prefer.

@joshuascan
Copy link
Member

joshuascan commented Mar 6, 2025

We believe the issue is related to our mobile message relaying service hanging, which is responsible for triggering the zIndex change on the iframe. Could you give @magic-sdk/[email protected] a try and see if that helps to resolve it?

Edit: actually, if you could use @magic-sdk/[email protected], this will include the same fix plus some additional logging that can help us debug further.

@RodrigoSarmento
Copy link

RodrigoSarmento commented Mar 7, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants