"Something went Wrong" when "Hide IP Address" is selected in Expo/React Native for iOS

This code runs fine in the simulator, but once it reaches our user’s iOS 17.4 app, we get an opaque “Something went Wrong” on both sapphire mainnet and devnet. On iOS 17.2 in simulator and on macOS , this error doesn’t occur at all.

See what it looks like:

  • SDK Version:
    @web3auth/openlogin-adapter”: “^7.3.2”,
    @web3auth/react-native-sdk”: “^5.1.0”,
    “crypto-browserify”: “^3.12.0”,
    “stream-browserify”: “^3.0.0”

  • Platform: iOS 17.4

Web3Auth initialization and login code snippet:

web3auth-login-source.tsx

import { LOGIN_PROVIDER } from '@web3auth/react-native-sdk'
import Web3Auth from '@web3auth/react-native-sdk'
import * as SecureStore from 'expo-secure-store'
import * as WebBrowser from 'expo-web-browser'
import { errorLike } from 'misc'

import { config } from '../config'
import { isExpoGo } from '../is-expo-go'
import { getAddress } from './ethereum-interface' // for using ethers.js
import type { LoginSource } from './login-source'

export class Web3AuthLoginSource implements LoginSource {
  private readonly web3auth = new Web3Auth(WebBrowser, SecureStore, {
    clientId: config.web3authApiKey,
    network: config.web3authNetwork,
    whiteLabel: {
      defaultLanguage: 'en',
      mode: 'light',
      theme: {
        primary: '#06373A',
      },
    },
  })

  async login(sms: string): Promise<string | undefined> {
    // 'exp' is the schema used when going through Expo Go.
    // https://docs.expo.dev/guides/deep-linking/
    const redirectUrl = `${isExpoGo ? 'exp' : 'com.antelo.now'}://onlogin`

    try {
      await this.ensureInitialized()
      await this.web3auth.login({
        loginProvider: LOGIN_PROVIDER.SMS_PASSWORDLESS,
        redirectUrl,
        extraLoginOptions: {
          login_hint: sms,
        },
      })

      if (!this.web3auth.privKey) {
        throw new Error('Login failed')
      }

      return getAddress(this.web3auth.privKey)
    } catch (e) {
      if (errorLike(e).message?.includes('error type dismiss')) {
        // user dismissed web3auth attempt (for example, by navigating back)
        return undefined
      }

      throw e
    }
  }

  async walletAddress(): Promise<string | undefined> {
    await this.ensureInitialized()
    try {
      if (this.web3auth.userInfo() !== undefined) {
        return getAddress(this.web3auth.privKey)
      }
    } catch (e) {
      if (errorLike(e).message === 'user should be logged in to fetch userInfo') {
        return undefined
      }

      throw e
    }

    return undefined
  }

  async logout(): Promise<void> {
    await this.ensureInitialized()
    await this.web3auth.logout()
  }

  private async ensureInitialized(): Promise<void> {
    if (!this.web3auth.ready) {
      await this.web3auth.init()
    }
  }
}

1 Like

This issue is particularly seen when the session has expired or within 15 minutes the login procedure is not completed. Please let me know if this happens.

Could you also share the console logs How to debug iOS devices? to better understand the error.

When “Off” is selected it works. But many of my users will have it on. This is a key component in the app, how do you recommend I fix it?

1 Like

This is more to do with Safari browser settings, so we don’t have any control over that. Is the same issue happening with Google Chrome?

this is moving away from the main point; this is a major issue in production for iOS users.

How can I use uxMode: 'redirect' in my web3auth-login-source.tsx file?

@rbh Your request has been forwarded to our Dev team and we will get back with updates.

2 Likes

Any updates? This issue is causing major outages

Hello @rbh,

We appreciate you reaching out and highlighting this issue. The error you’re encountering could be related to how Safari’s “Hide IP Address” feature interacts with our authentication process. This feature, while enhancing privacy, may interfere with certain authentication protocols that rely on IP consistency to maintain session integrity.

We take such matters seriously and are investigating potential solutions that respect user privacy while maintaining a seamless authentication experience. In the meantime, as a workaround, you could inform your users about the potential impact of the “Hide IP Address” setting on login sessions within your app’s FAQ or troubleshooting guide.

Thank you for your patience and understanding as we work to resolve this. If you have any further information that could help us in our investigation, please feel free to share.

Hey @rbh

Adding to what Maharshi has mentioned, we are working internally for a workaround for cases where IP Addresses will be hidden for the users. Just to add to this, currently no production user should be impacted by this, since the iOS v17.4 has introduced this feature and is currently in beta. The current production version of iOS remains v17.3.1 - Apple security releases - Apple Support

Hi @yashovardhan and @maharshi , thanks for getting back to me

Our users are advanced and care a lot about privacy, some are already using the v17.4 public beta.

Additionally, 17.4 is set to be live before March 6th - this would snowball the issue further (see: iOS 17.4 is coming next month: Here's everything new so far - 9to5Mac) . Are you guaranteeing this will be solved before then?

Hello? It’s now past that date, and the exact issue we spoke of is now a nightmare case for our users, rendering our app unusable. Is anyone there?!

Hi @rbh,

Sorry for not providing an update. Our product team is looking into this issue.

I’ll give you an update as soon as I have news.

Hi Tom, thank you

I really need urgent help now, just to get it working at least. Can I please get on a call with a member of your team asap.

Hey @rbh

Getting on a call will not solve this issue. This is affecting all our integrations and our team is effectively working on this. Once pushed it will be automatically fixed for you. Please bear with us in the meantime.

Hello RBH,

I wanted to give you a quick update on the issue you’ve been experiencing. Our team has been diligently working on resolving it for the past few weeks. It turns out that the problem is rooted in our infrastructure, impacting all our integrations significantly.

This issue is particularly noticeable for iCloud+ subscribers using iOS 14, as they encounter it upon enabling a specific feature. It’s important to note that this isn’t an isolated case; the release from Apple has similarly affected numerous major applications. To address this, we’ve been in close communication with the AWS team and have identified several potential workarounds.

Rest assured, we’re actively implementing fixes and will keep you updated with progress, aiming to resolve this as soon as possible.