Open.IdentityServer Toggle Menu
Documentation

    Introduction

    • The Big Picture
      • Authentication
      • API Access
      • OpenID Connect and OAuth 2.0 – better together
      • How Open.IdentityServer can help
    • Terminology
      • Open.IdentityServer
      • User
      • Client
      • Resources
      • Identity Token
      • Access Token
    • Supported Specifications
      • OpenID Connect
      • OAuth 2.0
    • Packaging and Builds
      • Open.IdentityServer main repo
      • Templates
    • Support and Consulting Options
      • Free support
      • Commercial support
    • Contributing
      • How to contribute?
      • General feedback and discussions?
      • Bugs and feature requests?
      • Contribution projects

    Quickstarts

    • Overview
      • Preparation
    • Protecting an API using Client Credentials
      • Source Code
      • Preparation
      • Setting up the ASP.NET Core application
      • Defining an API Scope
      • Defining the client
      • Configuring IdentityServer
      • Adding an API
        • Minimal API
        • Middleware Controllers
        • Adding a Nuget Dependency
        • Configuration
        • Minial API
        • Middleware Controllers
      • Creating the client
      • Calling the API
      • Authorization at the API
      • Further experiments
    • Interactive Applications with ASP.NET Core
      • Adding the UI
      • Creating an MVC client
      • Adding support for OpenID Connect Identity Scopes
      • Adding Test Users
      • Adding the MVC Client to the Open.IdentityServer Configuration
      • Testing the client
      • Adding sign-out
      • Getting claims from the UserInfo endpoint
      • Further Experiments
      • Adding Support for External Authentication
      • Adding Google support
      • Further experiments
    • ASP.NET Core and API access
      • Modifying the client configuration
      • Modifying the MVC client
      • Using the access token
      • Managing the access token
    • Adding a JavaScript client
      • New Project for the JavaScript client
      • Modify hosting
      • Add the static file middleware
      • Add a client registration to Open.IdentityServer for the JavaScript client
      • Allowing Ajax calls to the Web API with CORS
      • Run the JavaScript application
    • Using Entity Framework Core for configuration and operational data
      • Open.IdentityServer.EntityFramework
      • Using SqlServer
      • Database Schema Changes and Using EF Migrations
      • Configuring the Stores
      • Adding Migrations
      • Initializing the Database
      • Run the client applications
    • Using ASP.NET Identity
      • New Project for ASP.NET Core Identity
      • Inspect the new project
        • IdentityServerAspNetIdentity.csproj
        • Startup.cs
        • Config.cs
        • Program.cs and SeedData.cs
        • AccountController
      • Logging in with the MVC client
      • What’s Missing?

    Migrating

    • IdentityServer4 to Open.IdentityServer
      • Prerequisites
      • Migration Steps
      • Troubleshooting
    • Duende.IdentityServer to Open.IdentityServer
      • Prerequisites
      • Migration Steps
      • Troubleshooting

    Topics

    • Startup
      • Configuring services
      • Key material
      • In-Memory configuration stores
      • Test stores
      • Additional services
      • Caching
      • Configuring the pipeline
    • Compatibility
      • Keys Compatibility Store
    • Defining Resources
      • Identity Resources
      • APIs
        • Scopes
        • Authorization based on Scopes
        • Parameterized Scopes
        • API Resources
    • Defining Clients
      • Defining a client for server to server communication
      • Defining an interactive application for use authentication and delegated API access
      • Defining clients in appsettings.json
    • Sign-in
      • Cookie authentication
      • Overriding cookie handler configuration
      • Login User Interface and Identity Management System
      • Login Workflow
      • Login Context
      • Issuing a cookie and Claims
    • Sign-in with External Identity Providers
      • Adding authentication handlers for external providers
      • The role of cookies
      • Triggering the authentication handler
      • Handling the callback and signing in the user
      • State, URL length, and ISecureDataFormat
    • Windows Authentication
      • On Windows using IIS hosting
    • Sign-out
      • Removing the authentication cookie
      • Notifying clients that the user has signed-out
      • Sign-out initiated by a client application
    • Sign-out of External Identity Providers
    • Federated Sign-out
    • Federation Gateway
      • Implementation
    • Consent
      • Consent Page
      • Authorization Context
      • Informing Open.IdentityServer of the consent result
      • Returning the user to the authorization endpoint
    • Protecting APIs
      • Validating reference tokens
      • Supporting both JWTs and reference tokens
    • Deployment
      • Typical architecture
      • Configuration data
      • Key material
      • Operational data
      • ASP.NET Core data protection
      • ASP.NET Core distributed caching
    • Logging
      • Setup for Serilog
    • Events
      • Emitting events
      • Custom sinks
      • Built-in events
      • Custom events
    • Cryptography, Keys and HTTPS
      • Token signing and validation
      • Signing key rollover
      • Data protection
      • HTTPS
    • Grant Types
      • Machine to Machine Communication
      • Interactive Clients
      • Interactive clients without browsers or with constrained input devices
      • Custom scenarios
    • Client Authentication
      • Creating a shared secret
      • Authentication using a shared secret
      • Authentication using an asymmetric Key
    • Extension Grants
      • Example: Simple delegation using an extension grant
    • Resource Owner Password Validation
    • Refresh Tokens
      • Additional client settings
      • Requesting a refresh token
      • Requesting an access token using a refresh token
      • Customizing refresh token behavior
    • Reference Tokens
    • Persisted Grants
      • Persisted Grant
      • Grant Consumption
      • Persisted Grant Service
    • Using Resource Indicators
      • Configuration
      • Requesting Tokens
      • Token Result
      • Validation
    • Proof-of-Possession Access Tokens
    • Mutual TLS
      • Server setup
      • ASP.NET Core setup
      • Open.IdentityServer setup
      • Client authentication
        • Using a client certificate to authenticate to Open.IdentityServer
      • Sender-constrained access tokens
        • Confirmation claim
        • Validating and accepting a client certificate in APIs
        • Introspection and the confirmation claim
      • Ephemeral client certificates
        • Using an ephemeral certificate to request a token
    • Authorize Request Objects
      • Passing request JWTs by reference
      • Accessing the request object data
    • Custom Token Request Validation and Issuance
    • CORS
      • Client-based CORS Configuration
      • Custom Cors Policy Service
      • Mixing Open.IdentityServer’s CORS policy with ASP.NET Core’s CORS policies
    • Discovery
      • Extending discovery
    • Adding more API Endpoints
      • Discovery
      • Advanced
      • Claims Transformation
    • Adding new Protocols
      • Typical authentication workflow
      • Useful Open.IdentityServer services
    • Tools

    Endpoints

    • Discovery Endpoint
    • Authorize Endpoint
    • Token Endpoint
      • Example
    • UserInfo Endpoint
      • Example
    • Device Authorization Endpoint
      • Example
    • Introspection Endpoint
      • Example
    • Revocation Endpoint
      • Example
    • End Session Endpoint
      • Parameters
      • Example

    Reference

    • IdentityServer Options
      • Endpoints
      • Discovery
      • Authentication
      • Events
      • InputLengthRestrictions
      • UserInteraction
      • Caching
      • CORS
      • CSP (Content Security Policy)
      • Device Flow
      • Mutual TLS
    • Identity Resource
    • API Scope
      • Defining API scope in appsettings.json
      • Unused Compatibility Properties
    • API Resource
      • Defining API resources in appsettings.json
    • Client
      • Basics
      • Authentication/Logout
      • Token
      • Consent Screen
      • Device flow
      • Unused Compatibility Properties
    • GrantValidationResult
    • Profile Service
      • IProfileService APIs
      • ProfileDataRequestContext
      • Requested scopes and claims mapping
      • IsActiveContext
    • IdentityServer Interaction Service
      • IIdentityServerInteractionService APIs
      • AuthorizationRequest
      • ResourceValidationResult
      • ErrorMessage
      • LogoutRequest
      • ConsentResponse
      • Grant
    • Device Flow Interaction Service
      • IDeviceFlowInteractionService APIs
      • DeviceFlowAuthorizationRequest
      • DeviceFlowInteractionResult
    • Entity Framework Support
      • Configuration Store support for Clients, Resources, and CORS settings
      • ConfigurationStoreOptions
      • Operational Store support for persisted grants
      • OperationalStoreOptions
      • Database creation and schema changes across different versions of IdentityServer
      • Generating Delta Scripts
    • ASP.NET Identity Support
    • Internalised IdentityModel Resources
      • Internalised Content from IdentityModel package
      • Recommendations for Client Side

    Misc

    • Articles
    • Videos
  • Documentation

Consent

Documentation

    Introduction

    • The Big Picture
    • Terminology
    • Supported Specifications
    • Packaging and Builds
    • Support and Consulting Options
    • Contributing

    Quickstarts

    • Overview
    • Protecting an API using Client Credentials
    • Interactive Applications with ASP.NET Core
    • ASP.NET Core and API access
    • Adding a JavaScript client
    • Using Entity Framework Core for configuration and operational data
    • Using ASP.NET Identity

    Migrating

    • IdentityServer4 to Open.IdentityServer
    • Duende.IdentityServer to Open.IdentityServer

    Topics

    • Startup
    • Compatibility
    • Defining Resources
    • Defining Clients
    • Sign-in
    • Sign-in with External Identity Providers
    • Windows Authentication
    • Sign-out
    • Sign-out of External Identity Providers
    • Federated Sign-out
    • Federation Gateway
    • Consent
    • Protecting APIs
    • Deployment
    • Logging
    • Events
    • Cryptography, Keys and HTTPS
    • Grant Types
    • Client Authentication
    • Extension Grants
    • Resource Owner Password Validation
    • Refresh Tokens
    • Reference Tokens
    • Persisted Grants
    • Using Resource Indicators
    • Proof-of-Possession Access Tokens
    • Mutual TLS
    • Authorize Request Objects
    • Custom Token Request Validation and Issuance
    • CORS
    • Discovery
    • Adding more API Endpoints
    • Adding new Protocols
    • Tools

    Endpoints

    • Discovery Endpoint
    • Authorize Endpoint
    • Token Endpoint
    • UserInfo Endpoint
    • Device Authorization Endpoint
    • Introspection Endpoint
    • Revocation Endpoint
    • End Session Endpoint

    Reference

    • IdentityServer Options
    • Identity Resource
    • API Scope
    • API Resource
    • Client
    • GrantValidationResult
    • Profile Service
    • IdentityServer Interaction Service
    • Device Flow Interaction Service
    • Entity Framework Support
    • ASP.NET Identity Support
    • Internalised IdentityModel Resources

    Misc

    • Articles
    • Videos

Consent

  • Consent
    • Consent Page
    • Authorization Context
    • Informing Open.IdentityServer of the consent result
    • Returning the user to the authorization endpoint

During an authorization request, if Open.IdentityServer requires user consent the browser will be redirected to the consent page.

Consent is used to allow an end user to grant a client access to resources (identity or API). This is typically only necessary for third-party clients, and can be enabled/disabled per-client on the client settings.

Consent Page¶

In order for the user to grant consent, a consent page must be provided by the hosting application.

A consent page normally renders the display name of the current user, the display name of the client requesting access, the logo of the client, a link for more information about the client, and the list of resources the client is requesting access to. It’s also common to allow the user to indicate that their consent should be “remembered” so they are not prompted again in the future for the same client.

Once the user has provided consent, the consent page must inform Open.IdentityServer of the consent, and then the browser must be redirected back to the authorization endpoint.

Authorization Context¶

Open.IdentityServer will pass a returnUrl parameter (configurable on the user interaction options) to the consent page which contains the parameters of the authorization request. These parameters provide the context for the consent page, and can be read with help from the interaction service. The GetAuthorizationContextAsync API will return an instance of AuthorizationRequest.

Additional details about the client or resources can be obtained using the IClientStore and IResourceStore interfaces.

Informing Open.IdentityServer of the consent result¶

The GrantConsentAsync API on the interaction service allows the consent page to inform Open.IdentityServer of the outcome of consent (which might also be to deny the client access).

Open.IdentityServer will temporarily persist the outcome of the consent. This persistence uses a cookie by default, as it only needs to last long enough to convey the outcome back to the authorization endpoint. This temporary persistence is different than the persistence used for the “remember my consent” feature (and it is the authorization endpoint which persists the “remember my consent” for the user). If you wish to use some other persistence between the consent page and the authorization redirect, then you can implement IMessageStore<ConsentResponse> and register the implementation in DI.

Returning the user to the authorization endpoint¶

Once the consent page has informed Open.IdentityServer of the outcome, the user can be redirected back to the returnUrl. Your consent page should protect against open redirects by verifying that the returnUrl is valid. This can be done by calling IsValidReturnUrl on the interaction service. Also, if GetAuthorizationContextAsync returns a non-null result, then you can also trust that the returnUrl is valid.

Previous Next
Copyright 2020, Brock Allen & Dominick Baier. Copyright in modifications 2026, Rock Solid Knowledge.•v1.0.0 Last updated Monday 1 June 2026