duendesoftware/duende-skills/identityserver-ui-flows
Claude Code and agent skill by duendesoftware/duende-skills
- community
Checking that the SKILL.md file is still in the repository.
Guide for building login, logout, consent, error, and federation gateway UI pages in Duende IdentityServer, including IIdentityServerInteractionService usage, external provider integration, and Home Realm Discovery strategies.
Install
npx vskill@latest install duendesoftware/duende-skills/identityserver-ui-flowsSKILL.md
The same SKILL.md was published earlier as duendesoftware/duende-skills/identityserver-ui-flows.
IdentityServer UI Flows: Login, Logout, Consent, and Federation
When to Use This Skill
- Building or customizing the login page (local credentials, MFA, passwordless)
- Integrating external identity providers (Google, Azure AD, SAML, etc.)
- Implementing the consent page for third-party client authorization
- Building the logout flow with session cleanup and client notifications
- Implementing a federation gateway with Home Realm Discovery (HRD)
- Handling and displaying error pages for protocol errors
- Using
IIdentityServerInteractionServiceto interact with the protocol engine - Redirecting users back to clients after login/logout
Docs: https://docs.duendesoftware.com/identityserver/ui
Architecture Overview
IdentityServer separates the protocol engine from the user interface. The engine handles OAuth/OIDC endpoints and redirects to your UI pages as needed. Your UI code handles all user interaction and then communicates results back to the engine.
Required Pages
| Page | Purpose | Default URL | |
|---|---|---|---|
| Login | Establish authentication session | Inferred from cookie handler LoginPath | |
| Logout | Terminate session, notify clients | Set via opt.UserInteraction.LogoutUrl | |
| Consent | Grant/deny client access to resources | /consent | |
| Error | Display protocol error information | /home/error |
Login Page
Configuring the Login URL
If not set, IdentityServer infers the URL from the cookie handler's LoginPath:
Authorization Context
When IdentityServer redirects to the login page, it passes a returnUrl query parameter. Use IIdentityServerInteractionService.GetAuthorizationContextAsync to extract the original authorization request parameters:
Important: Do not parse the returnUrl yourself. Always use the interaction service.
Establishing the Authentication Session
After validating credentials, create the authentication session:
Or with explicit claims:
Well-Known Session Claims
| Claim | Purpose | Default | |
|---|---|---|---|
sub | Required. Unique user identifier. Must never change or be reassigned. | None — you must provide it | |
name | Display name of the user | None | |
amr | Authentication method reference | pwd | |
auth_time | Time user entered credentials (epoch) | Current time | |
idp | Identity provider scheme name | local | |
tenant | Tenant identifier | None |
Protecting Against Open Redirects
Always validate the returnUrl before redirecting:
Completing Login with CompleteLoginAsync
After establishing the authentication session, redirect the user back to the returnUrl. This causes the browser to re-issue the original authorize request, allowing IdentityServer to complete the protocol workflow.
External Login (Federation)
Registering External Providers
Triggering External Authentication
Handling the Callback
SignInScheme and SignOutScheme
| Scenario | SignInScheme | SignOutScheme | |
|---|---|---|---|
| Without ASP.NET Identity | IdentityServerConstants.ExternalCookieAuthenticationScheme | IdentityServerConstants.SignoutScheme | |
| With ASP.NET Identity | IdentityServerConstants.ExternalCookieAuthenticationScheme | IdentityConstants.ApplicationScheme |
State and URL Length
If external provider state makes the URL too long (>2000 chars), use the IdentityServer-provided IDistributedCache-backed data format:
Logout Page
Configuring the Logout URL
Logout Steps
- End the IdentityServer session — remove the authentication cookie
- Sign out of external provider — if an external login was used
- Notify client applications — via front-channel, back-channel, or JS-based notifications
- Redirect back to client — if the logout is client-initiated
Client Notification Mechanisms
| Mechanism | How It Works | Client Setting | |
|---|---|---|---|
| Front-channel | Render <iframe> on logged-out page pointing to client's logout URI | FrontChannelLogoutUri | |
| Back-channel | Server-to-server HTTP call with a logout JWT (typ: logout+jwt) | BackChannelLogoutUri | |
| JS-based | Client monitors check_session_iframe | Built into spec-compliant JS clients |
Recommendation: Use back-channel notifications for cross-site architectures. Front-channel and JS-based notifications rely on cookies in iframes, which may not work reliably across different sites.
Getting Logout Context
Back-Channel Logout
Back-channel logout happens automatically when you call HttpContext.SignOutAsync() — IdentityServer uses IBackChannelLogoutService to notify all clients that have BackChannelLogoutUri configured.
For .NET clients: use the BFF framework which has built-in back-channel logout support, or see the IdentityServer samples.
Consent Page
When Consent Is Required
Consent applies only to user-based (interactive) authorization requests. Client-credentials (M2M) flows never prompt for consent — there Client.AllowedScopes alone governs access.
Consent is controlled per client via RequireConsent (default: false). Set RequireConsent = false for first-party clients to suppress the scope prompt; set true for third-party clients. When enabled, IdentityServer redirects to the consent page before completing authorization.
The offline_access scope always triggers consent when the client has consent enabled.
Required vs. Optional Scopes
IdentityResource and ApiScope expose a Required bool:
- If the consent response omits a `Required` scope, IdentityServer returns
access_deniedand the request fails. - Optional scopes can be declined and the flow still succeeds — the issued tokens/userinfo simply omit that data.
Remembered Consent
Enable persistence with Client.AllowRememberConsent (bool) and Client.ConsentLifetime (expiry). Granted scopes are stored in the operational (persisted grant) store; set RememberConsent = true on the ConsentResponse to persist a grant.
IdentityServer re-prompts for consent when:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/identityserver-ui-flows/SKILL.md
Popularity
- Repository stars
- 9
- Repository forks
- 3
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/duendesoftware/duende-skills/identityserver-ui-flows)