Can't use sign in with Apple natively and as a web authentication at the same time

I’m currently implementing Apple Sign In on an app (as Apple requires of apps that have other providers) and the IdToken that Apple returns natively on iOS 13/14 does not work with MongoDB Realm if it’s configured to use the ServiceId (as explained by the official MongoDB Apple ID Authentication guide).

I did manage to get it working natively, but then the web authentication stops working because I have to change the Client Id on Realm Apple Authentication configuration to use the App ID, not the Service ID.

This doesn’t seem right to me, Apple requires Apple ID authentication to be used on all iOS versions and it isn’t possible to use the native UI before iOS 13, so it’s always required to use both the native auth and the web auth.

How could I use the native UI for iOS 13/14 and the web UI for all the others?

1 Like

We’re facing the same problem, is there a way to specify two client ID’s? We tried comma exasperated, space separated, and semi-colon separated values but none of them seem to work even though no errors are thrown.

That would really fix the issue, but I don’t think there’s a way to have two client ID’s. I tried to use Realm CLI to change the string into an array, but when I imported the configuration file into Realm the CLI complained that the field must be a string.

For now, my “workaround” is to use the web service even for iOS 13+. The app opens an SFSafariViewController modally and when on iOS 13+ the native authentication dialog pops up automatically even if it was initiated on the web, then Safari gets redirected to the redirect URL and you can go back to the app with a custom URL scheme.

Even though this works, it’s not ideal and doesn’t make sense for Realm to not support both native and web at the same time as they will always be used together (to support both iOS 13+ and <=12).

On 2021 August still facing the same issue. It is still not possible to do it via UI.

@Andrew_Morgan hey Andrew do you have any idea on this? Thanks for all the great videos you posted on YouTube! Awesome content!

@Luccas_Clezar @Chris_Long @Dududu Did you find a way to do this?