Swift Auth0 - Safari cannot open the page because the address is invalid

I’m following this tutorial:

https://auth0.com/docs/quickstart/native/ios-swift/getting-started#configure-callback-urls

I can login to my app in the simulator. On the login screen I click LOGIN WITH GOOGLE. After that I get the error:

Safari cannot open the page because the address is invalid

Info.plist includes:

<key>CFBundleTypeRole</key>
<string>None</string>
<key>CFBundleURLName</key>
<string>auth0</string>
<key>CFBundleURLSchemes</key>
<array>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>

AppDelegate.swift includes:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.
    
    return true
}

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
    return Auth0.resumeAuth(url, options: options)
}

What am I missing?

The issue was that the URL stuff needed to be nested under CFBundleURLTypes:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>None</string>
        <key>CFBundleURLName</key>
        <string>auth0</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
        </array>
    </dict>
</array>
2 Likes