Skip to content

Use PAR endpoint for authorization URL generation - #33694

Closed
Night1 wants to merge 2 commits into
immich-app:mainfrom
Night1:main
Closed

Night1 wants to merge 2 commits into
immich-app:mainfrom
Night1:main

Conversation

@Night1

@Night1 Night1 commented Nov 26, 2026 •

Copy link
Copy Markdown

feat(server): add RFC 9126 Pushed Authorization Requests (PAR) support to OAuth

Add Pushed Authorization Request (PAR) support to the OAuth/OIDC authorization flow in OAuthRepository.authorize() when the identity provider advertises pushed_authorization_request_endpoint in server metadata.

When pushed_authorization_request_endpoint is present, authorization parameters (redirect_uri, scope, state, PKCE code_challenge and code_challenge_method, and optional prompt) are pushed over a backchannel request using buildAuthorizationUrlWithPAR, and the browser redirect URL is built from the returned request_uri. When absent, authorization falls back to standard buildAuthorizationUrl.

Reuses the openid-client instance from getClient(), preserving existing client authentication methods, request timeouts, and allowInsecureRequests settings while remaining backward-compatible with providers that do not support PAR.

Description

Adds support for RFC 9126 Pushed Authorization Requests (PAR) during the OAuth/OIDC authorization flow when advertised by the identity provider.

It enables more secure OIDC authentication by pushing authorization parameters over a backchannel request using buildAuthorizationUrlWithPAR (which openid-client already provides) when pushed_authorization_request_endpoint is present in server metadata, and falling back to standard buildAuthorizationUrl otherwise.

Fixes # (issue)
None

How Has This Been Tested?

Tested against Pocket ID using both hardware security keys and platform authenticators (Windows Hello and Android built-in passkeys) across Chrome, Edge, Brave, and Android.

Screenshots (if appropriate)

Checklist:

  • I have carefully read CONTRIBUTING.md
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
  • I have no unrelated changes in the PR.
  • I have confirmed that any new dependencies are strictly necessary.
  • I have written tests for new code (if applicable)
  • I have followed naming conventions/patterns in the surrounding code
  • All code in src/services/ uses repositories implementations for database calls, filesystem operations, etc.
  • All code in src/repositories/ is pretty basic/simple and does not have any immich specific logic (that belongs in src/services/)

Please describe to which degree, if any, an LLM was used in creating this pull request.

Used an LLM only to check openid-client PAR helpers and trace the flow; I wrote the change and tested it myself.
...

...

feat(server): add RFC 9126 Pushed Authorization Requests (PAR) support to OAuth

Add Pushed Authorization Request (PAR) support to the OAuth/OIDC authorization
flow in OAuthRepository.authorize() when the identity provider advertises
pushed_authorization_request_endpoint in server metadata.

When pushed_authorization_request_endpoint is present, authorization
parameters (redirect_uri, scope, state, PKCE code_challenge and
code_challenge_method, and optional prompt) are pushed over a backchannel
request using buildAuthorizationUrlWithPAR, and the browser redirect URL is
built from the returned request_uri. When absent, authorization falls back
to standard buildAuthorizationUrl.

Reuses the openid-client instance from getClient(), preserving existing
client authentication methods, request timeouts, and allowInsecureRequests
settings while remaining backward-compatible with providers that do not
support PAR.
@immich-push-o-matic

immich-push-o-matic Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Label error. Requires exactly 1 of: changelog:.*. Found: 🗄️server. A maintainer will add the required label.

@github-actions

Copy link
Copy Markdown
Contributor

This PR has been automatically closed as the description doesn't follow our template. Please make sure every section is present and filled in. After you edit it to match the template, the PR will automatically be reopened.

@danieldietzler

danieldietzler commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

From reading into it, it seems like this actually does not bring any significant security benefits to Immich users (since we only send redirect_uri, scope, state, the PKCE challenge, and prompt), while at the same time having a few downsides:

  • when something fails you won't see a proper error page anymore, meaning users won't be able to easily tell that they misconfigured their redirect_uri for instance
  • apparently some IDPs advertise PAR in general, but only support it when specifically enabled for that application
  • seemingly PAR support used to be rather buggy.

Overall, while the change may look minimal, I think this adds another point that can possibly break for users and thus provide an inferior experience. In fact, since there isn't any config for this, people cannot even turn of PAR if their IDP supports it. However, I don't really want to add the additional complexity in the form of another config setting for this either.

Tl;dr unless you have a really strong security argument for this and Immich's use cases that I might have missed/am not aware of, I will close this PR. Sorry!

@Night1

Night1 commented Nov 26, 2026

Copy link
Copy Markdown
Author

Talked with Daniel on discord, closing this

@Night1 Night1 closed this Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants