Skip to content

Add support for passkeys on login#3996

Merged
marinofaggiana merged 6 commits intomasterfrom
login-browser
Feb 21, 2026
Merged

Add support for passkeys on login#3996
marinofaggiana merged 6 commits intomasterfrom
login-browser

Conversation

@mpivchev
Copy link
Collaborator

@mpivchev mpivchev commented Feb 20, 2026

Thanks to @UBaggeler for his original proposal: #3938

Implemented ASWebAuthenticationSession that allows the use of passkeys on log in.
Also potentially fixes "unsupported browser" issue.

Fixes:
#1645
#2901
#3636
#2300

and more.

WKWebView is still used as a fallback for mTLS importing: #3685 (WIP)

Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes the iOS login flow by implementing ASWebAuthenticationSession for passkey support while maintaining a WKWebView fallback for mTLS certificate authentication. The change addresses multiple issues with WebAuthn, SAML authentication, and OIDC provider compatibility that were failing in the previous WKWebView-only implementation.

Changes:

  • Refactored NCLoginProvider from a UIViewController to an NSObject that manages authentication via ASWebAuthenticationSession with automatic fallback to WKWebView for mTLS
  • Extracted WKWebView functionality into a separate NCLoginProviderWebViewFallback view controller for certificate handling scenarios
  • Updated login flow initiators (NCLogin and NCIntroViewController) to use the new authentication model

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 14 comments.

File Description
iOSClient/Login/NCLoginProvider.swift Major refactoring to use ASWebAuthenticationSession as primary authentication method with WKWebView fallback; split into two classes for separation of concerns
iOSClient/Login/NCLogin.swift Updated to instantiate and manage the new NCLoginProvider lifecycle with proper cleanup
Brand/Intro/NCIntroViewController.swift Updated signup flow to use new NCLoginProvider authentication pattern

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@marinofaggiana marinofaggiana self-requested a review February 21, 2026 11:14
@marinofaggiana marinofaggiana merged commit 69cb8c5 into master Feb 21, 2026
5 checks passed
@marinofaggiana marinofaggiana deleted the login-browser branch February 21, 2026 11:15
tdhooghe pushed a commit to tdhooghe/swiftnextcloudui that referenced this pull request Mar 8, 2026
WKWebView silently fails to complete cross-domain OIDC redirects (e.g.
when Nextcloud delegates authentication to an external IdP like Authentik).
The user authenticates successfully on the IdP side, but WKWebView drops
the callback redirect back to the Nextcloud origin, leaving the login
flow stuck in a polling loop that never resolves.

ASWebAuthenticationSession uses the system browser which properly handles
cross-domain redirects, passkeys, and deep links. Credentials continue
to be obtained via the existing polling mechanism.

macOS retains the WKWebView sheet since ASWebAuthenticationSession
behaves differently on that platform and cross-domain redirects are
less problematic there.

Ref: nextcloud/ios#3996 (same fix applied to the main iOS app)
Made-with: Cursor
tdhooghe pushed a commit to tdhooghe/swiftnextcloudui that referenced this pull request Mar 8, 2026
WKWebView silently fails to complete cross-domain OIDC redirects (e.g.
when Nextcloud delegates authentication to an external IdP like Authentik).
The user authenticates successfully on the IdP side, but WKWebView drops
the callback redirect back to the Nextcloud origin, leaving the login
flow stuck in a polling loop that never resolves.

Replace WKWebView with ASWebAuthenticationSession on iOS via a new
LoginSheet view modifier that encapsulates the platform difference:
- iOS: ASWebAuthenticationSession (system browser, handles OIDC/passkeys)
- macOS: WKWebView sheet (unchanged behavior)

ServerAddressView is now platform-agnostic — it just sets isPresented
and the modifier does the right thing per platform. Credentials continue
to be obtained via the host app's existing polling mechanism.

Ref: nextcloud/ios#3996 (same fix applied to the main iOS app)
Made-with: Cursor
tdhooghe pushed a commit to tdhooghe/swiftnextcloudui that referenced this pull request Mar 8, 2026
WKWebView silently fails to complete cross-domain OIDC redirects (e.g.
when Nextcloud delegates authentication to an external IdP like Authentik).
The user authenticates successfully on the IdP side, but WKWebView drops
the callback redirect back to the Nextcloud origin, leaving the login
flow stuck in a polling loop that never resolves.

Replace WKWebView with ASWebAuthenticationSession on iOS via a new
LoginSheet view modifier that encapsulates the platform difference:
- iOS: ASWebAuthenticationSession (system browser, handles OIDC/passkeys)
- macOS: WKWebView sheet (unchanged behavior)

ServerAddressView is now platform-agnostic — it just sets isPresented
and the modifier does the right thing per platform. Credentials continue
to be obtained via the host app's existing polling mechanism.

Ref: nextcloud/ios#3996 (same fix applied to the main iOS app)
Made-with: Cursor
tdhooghe pushed a commit to tdhooghe/swiftnextcloudui that referenced this pull request Mar 8, 2026
WKWebView silently fails to complete cross-domain OIDC redirects (e.g.
when Nextcloud delegates authentication to an external IdP like Authentik).
The user authenticates successfully on the IdP side, but WKWebView drops
the callback redirect back to the Nextcloud origin, leaving the login
flow stuck in a polling loop that never resolves.

Replace WKWebView with ASWebAuthenticationSession on iOS via a new
LoginSheet view modifier that encapsulates the platform difference:
- iOS: ASWebAuthenticationSession (system browser, handles OIDC/passkeys)
- macOS: WKWebView sheet (unchanged behavior)

ServerAddressView is now platform-agnostic — it just sets isPresented
and the modifier does the right thing per platform. Credentials continue
to be obtained via the host app's existing polling mechanism.

Ref: nextcloud/ios#3996 (same fix applied to the main iOS app)
Made-with: Cursor
tdhooghe pushed a commit to tdhooghe/swiftnextcloudui that referenced this pull request Mar 8, 2026
WKWebView silently fails to complete cross-domain OIDC redirects (e.g.
when Nextcloud delegates authentication to an external IdP like Authentik).
The user authenticates successfully on the IdP side, but WKWebView drops
the callback redirect back to the Nextcloud origin, leaving the login
flow stuck in a polling loop that never resolves.

Replace WKWebView with ASWebAuthenticationSession on iOS via a new
LoginSheet view modifier that encapsulates the platform difference:
- iOS: ASWebAuthenticationSession (system browser, handles OIDC/passkeys)
- macOS: WKWebView sheet (unchanged behavior)

ServerAddressView is now platform-agnostic — it just sets isPresented
and the modifier does the right thing per platform. Credentials continue
to be obtained via the host app's existing polling mechanism.

Ref: nextcloud/ios#3996 (same fix applied to the main iOS app)
Made-with: Cursor
tdhooghe added a commit to tdhooghe/swiftnextcloudui that referenced this pull request Mar 8, 2026
WKWebView silently fails to complete cross-domain OIDC redirects (e.g.
when Nextcloud delegates authentication to an external IdP like Authentik).
The user authenticates successfully on the IdP side, but WKWebView drops
the callback redirect back to the Nextcloud origin, leaving the login
flow stuck in a polling loop that never resolves.

Replace WKWebView with ASWebAuthenticationSession on iOS via a new
LoginSheet view modifier that encapsulates the platform difference:
- iOS: ASWebAuthenticationSession (system browser, handles OIDC/passkeys)
- macOS: WKWebView sheet (unchanged behavior)

ServerAddressView is now platform-agnostic — it just sets isPresented
and the modifier does the right thing per platform. Credentials continue
to be obtained via the host app's existing polling mechanism.

Ref: nextcloud/ios#3996 (same fix applied to the main iOS app)
Made-with: Cursor
Signed-off-by: Thomas <61279337+tdhooghe@users.noreply.github.com>
Made-with: Cursor
tdhooghe added a commit to tdhooghe/swiftnextcloudui that referenced this pull request Mar 8, 2026
WKWebView silently fails to complete cross-domain OIDC redirects (e.g.
when Nextcloud delegates authentication to an external IdP like Authentik).
The user authenticates successfully on the IdP side, but WKWebView drops
the callback redirect back to the Nextcloud origin, leaving the login
flow stuck in a polling loop that never resolves.

Replace WKWebView with ASWebAuthenticationSession on iOS via a new
LoginSheet view modifier that encapsulates the platform difference:
- iOS: ASWebAuthenticationSession (system browser, handles OIDC/passkeys)
- macOS: WKWebView sheet (unchanged behavior)

ServerAddressView is now platform-agnostic — it just sets isPresented
and the modifier does the right thing per platform. Credentials continue
to be obtained via the host app's existing polling mechanism.

Ref: nextcloud/ios#3996 (same fix applied to the main iOS app)

Signed-off-by: Thomas Dhooghe <61279337+tdhooghe@users.noreply.github.com>
Made-with: Cursor
tdhooghe added a commit to tdhooghe/swiftnextcloudui that referenced this pull request Mar 8, 2026
WKWebView silently fails to complete cross-domain OIDC redirects (e.g.
when Nextcloud delegates authentication to an external IdP like Authentik).
The user authenticates successfully on the IdP side, but WKWebView drops
the callback redirect back to the Nextcloud origin, leaving the login
flow stuck in a polling loop that never resolves.

Replace WKWebView with ASWebAuthenticationSession on iOS via a new
LoginSheet view modifier that encapsulates the platform difference:
- iOS: ASWebAuthenticationSession (system browser, handles OIDC/passkeys)
- macOS: WKWebView sheet (unchanged behavior)

ServerAddressView is now platform-agnostic — it just sets isPresented
and the modifier does the right thing per platform. Credentials continue
to be obtained via the host app's existing polling mechanism.

Ref: nextcloud/ios#3996 (same fix applied to the main iOS app)

Signed-off-by: Thomas Dhooghe <61279337+tdhooghe@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants