What's the best approach to introduce user authentication for VisionOS

Hey community! I have an idea of social network for VisionOS. I'm trying to figure out the best approach to implement authentication flow for the users. I'm looking into Auth0 Package, but facing some issues with platform compatibility. Are there any recommendations?

I have auth0 in iOS app and that works just fine. I use webAuth() method and during migration to VisionOS I got the next error: "Module 'Auth0' has no member named 'webAuth'". I discovered the source code a little bit and found the next condition in "Auth0" file that are not passing: #if WEB_AUTH_PLATFORM. That should be the root cause why error occues on compilation stage. I tried to apply the flag "-DWEB_AUTH_PLATFORM" to "Swift Compiler - Custom Flags", but it didn't help. Are there any tweaks that I can apply to my project and make it work?

I would be happy if someone provide any relevant information. Thank you!

While I'm not familiar with Auth0's API, it sounds like it's a wrapper for ASWebAuthenticationSession. ASWebAuthenticationSession is fully supported on visionOS and is great if you need users to authenticate through a web browser rather than in native UI.

If you want your app to really shine, native sign-in within an app always feels better than jumping out to a web browser. For that, ASAuthorizationController is the best experience. The ASAuthorization family of APIs allows you to make a combined request for multiple types of credentials, if you support it. If the only sign in method you support is passwords, it provides a nice native sheet offering any passwords the user has. If you also support other methods like passkeys or Sign in with Apple, you can make a single request with all of those credential types and the system will offer whatever credentials the user currently has. This WWDC session is primarily focused on passkeys, but also goes over several ASAuthorization use cases.

What's the best approach to introduce user authentication for VisionOS
 
 
Q