Skip to content

Services IRedirectUriProvider

Mika Berglund edited this page Dec 25, 2025 · 1 revision

Redirect Uri Provider Service (IRedirectUriProvider)

The Redirect Uri Provider Service supplies the redirect URI used by authentication flows in Blazorade Id. The redirect URI is the application endpoint that the identity provider returns the user to after an authorization step.

Responsibilities

  • Provide a single redirect URI for the current application instance.
  • Ensure the redirect URI points to the route handled by the OAuth callback page.
  • Abstract how the redirect URI is constructed so other services do not need to depend on navigation or hosting details.

Members

  • GetRedirectUri: Returns the redirect URI to be used in authentication flows.

Default implementation

BlazorRedirectUriProvider

The default implementation uses Blazor's NavigationManager base URI as the origin and combines it with the route of the OAuth callback page.

Construction rules:

  • The base URI is taken from the current Blazor navigation context.
  • The callback route is appended to the base URI to form the final redirect URI.

This means the redirect URI adapts automatically to the current environment (for example, development, staging, or production), as long as the application base URI is correct.

Usage notes

  • The redirect URI must match a redirect URI registered for the application in the identity provider. If it does not, authorization code requests will fail.
  • Use this service wherever a redirect URI is required (for example, when creating authorization URLs or initiating authorization code requests), instead of constructing URIs ad hoc.
  • If you host the callback route under a different path, implement a custom Redirect Uri Provider Service that returns the appropriate URI.

References

Clone this wiki locally