Add external OAuth sign-in to the passkeys sample (stacked on #36617) - #36823
Closed
mattleibow wants to merge 1 commit into
Closed
Add external OAuth sign-in to the passkeys sample (stacked on #36617)#36823mattleibow wants to merge 1 commit into
mattleibow wants to merge 1 commit into
Conversation
Adds server-brokered external OAuth sign-in (Google/Microsoft/Facebook/Apple) next to the password and passkey flows, following the ASP.NET Core Backend-for-Frontend (BFF) pattern: the server runs the OAuth exchange, creates or links a local account, and hands the app only a session cookie — the app never sees the provider token. Server: ExternalProviders.cs config-gates each provider (only registered when its credentials are present); ExternalAuthEndpoints.cs exposes the native handshake (/native-auth/external/providers|start|complete|exchange) plus a /me/external server relay. One-time codes use ITimeLimitedDataProtector. Client: dynamic 'Sign in with <provider>' buttons driven by the discovery endpoint, and a 'Show my external profile' relay demo. Stacked on the Passkeys Essentials API PR (#36617); CI won't auto-run because the base branch is a feature branch, not a trigger branch. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8fa25a04-ac6e-44ad-ab51-96d594e4107d
mattleibow
temporarily deployed
to
copilot-pat-pool
July 27, 2026 12:58 — with
GitHub Actions
Inactive
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
mattleibow
temporarily deployed
to
copilot-pat-pool
July 27, 2026 12:58 — with
GitHub Actions
Inactive
mattleibow
temporarily deployed
to
copilot-pat-pool
July 27, 2026 12:58 — with
GitHub Actions
Inactive
mattleibow
temporarily deployed
to
copilot-pat-pool
July 27, 2026 13:00 — with
GitHub Actions
Inactive
mattleibow
temporarily deployed
to
copilot-pat-pool
July 27, 2026 13:01 — with
GitHub Actions
Inactive
mattleibow
temporarily deployed
to
copilot-pat-pool
July 27, 2026 13:01 — with
GitHub Actions
Inactive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Stacked on #36617
This PR is stacked on top of the Passkeys Essentials API PR (#36617). Its base branch is
mattleibow-spec-passkeys-essentials, notnet11.0, so review #36617 first. Because the base is a feature branch (notmain/net*.0/release/*/inflight/*), themaui-prpipeline will not auto-run here — that is expected. When #36617 merges, this PR's base should be retargeted so CI runs.Because the base is the passkeys branch, the GitHub "Files changed" tab already shows only the OAuth additions. Direct compare link: mattleibow-spec-passkeys-essentials...mattleibow-spec-passkeys-oauth
What this adds
Adds server-brokered external OAuth sign-in (Google / Microsoft / Facebook / Apple) to the Essentials passkeys sample, alongside the existing password and passkey flows. It follows the ASP.NET Core Backend-for-Frontend (BFF) pattern, which is the current official recommendation for native clients:
/me/externalendpoint relays profile data that the server fetches on the app's behalf.This is purely additive to the sample and reference server — it touches no
Microsoft.Maui.*product code and adds no public API.Server (
Samples.WebServer)ExternalProviders.cs—AddConfiguredExternalProvidersregisters Google/Microsoft/Facebook/Apple only when their credentials are present in configuration, so the sample runs with none, some, or all of them. No provider is hard-coded on.ExternalAuthEndpoints.cs— the native BFF handshake:GET /native-auth/external/providers— discovery (what's configured).GET /native-auth/external/start— challenges the provider viaConfigureExternalAuthenticationProperties./complete— creates/links the local account and issues a one-time code (anITimeLimitedDataProtectortoken — framework crypto, no custom store).POST /native-auth/external/exchange— swaps the one-time code for an Identity cookie session in the app'sCookieContainer.GET /me/external— server-relayed provider profile.Microsoft.AspNetCore.Authentication.{Google,MicrosoftAccount,Facebook}+AspNet.Security.OAuth.Apple), all restored from repo feeds.appsettings.jsongains a documented (empty)Authenticationsection; real credentials go in the server's user-secrets, never in source.Client (Essentials sample)
Security posture
To enable a real provider
Add credentials to the server's user-secrets under
Authentication:{Google|Microsoft|Facebook|Apple}and register the matching redirect URIs (https://<domain>/signin-google, etc.). No code changes needed.