IOS login redirect is not firing

When asking for help in this category, please make sure to provide the following details:

  • SDK Version: web3auth_flutter: ^3.1.7
  • Platform: IOS version 17.4.1 - device iPhone 14 Pro Max
  • web3auth-swift-sdk version: 7.5.0

Hi, i have issue with login on IOS, on Android everything works good, so the issue is that redirect upon login is not firing, so basically browser view is closing, and i remain on the same login screen, however authorization is successfull. No any errors in flutter terminal or xcode. I followed installation instructions, aswell checked all of the examples code, and noticed that your examples are missing auth screens, also your examples are missing Info.plist config for custom URL schema, and in your installation instructions you only state that i need to whitelist {bundle.id}://auth in dashboard.
I’v tried with custom scheme defined in info.plist and tried without it aswell. With following custom schema i can confirm that redirect to my app auth screen is working fine if i open browser and enter com.example.wormfare://auth. But when it comes to webview its not firing at all, also i tried to pass some incorrect redirect urls to init function, and there is no any errors.

		<dict>
			<key>CFBundleTypeRole</key>
			<string>Editor</string>
			<key>CFBundleURLName</key>
			<string>com.example.wormfare</string>
			<key>CFBundleURLSchemes</key>
			<array>
				<string>com.example.wormfare</string>
			</array>
		</dict>

My init code:

    await Web3AuthFlutter.init(Web3AuthOptions(
      clientId: AppConfig.web3AuthClientId,
      buildEnv: BuildEnv.production,
      network: Network.sapphire_devnet,
      redirectUrl: "com.example.wormfare://auth",
      sessionTime: 604800,
    ));

    await Web3AuthFlutter.initialize();

and login code:

  Future<void> login(LoginProvider loginProvider, String? email) async {
    late Provider provider;

    switch (loginProvider) {
      case LoginProvider.google:
        provider = Provider.google;
        break;
      case LoginProvider.facebook:
        provider = Provider.facebook;
        break;
      case LoginProvider.apple:
        provider = Provider.apple;
      case LoginProvider.email:
        provider = Provider.email_passwordless;
    }

    try {
      await Web3AuthFlutter.login(
        LoginParams(
            loginProvider: provider,
            mfaLevel: MFALevel.NONE,
            extraLoginOptions: ExtraLoginOptions(
                login_hint:
                    loginProvider == LoginProvider.email ? email : null)),
      );
    } catch (e) {
      print(e);
    }
  }

And here is report from flutter doctor

 Flutter (Channel stable, 3.19.6, on macOS 14.4.1 23E224 darwin-arm64, locale ru-UA)
    • Flutter version 3.19.6 on channel stable at /Users/max/Documents/dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (7 days ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/max/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)

[✓] VS Code (version 1.88.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.86.0

[✓] Connected device (3 available)
    • iPhone (Alex) (mobile) • 00008120-000005DA3444C01E • ios            • iOS 17.4.1 21E236
    • macOS (desktop)        • macos                     • darwin-arm64   • macOS 14.4.1 23E224
      darwin-arm64
    • Chrome (web)           • chrome                    • web-javascript • Google Chrome 124.0.6367.61

[✓] Network resources
    • All expected network resources are available.

Hey @sailorjerry777, thanks for bringing it in, as discussed, the redirectUrl is for redirecting back to the page login is initiated, for custom redirecting, you can redirect the user to desired screen upon success.

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