Skip to content

Conversation

@Yetangitu
Copy link
Contributor

By launching Immich with /auth/login?autoLaunch=1 an OpenID Connect login attempt is directly initated on installations where OAuth Auto Launch is not enabled. The intended use for this parameter is to enable Immich to be launched from e.g. Nextcloud using the External sites app and the oids OpenID Connect provider app so as to enable the user to directly interact with Immich without the need to press the Login with ... button.

Description

This PR implements the feature suggested in #18751:

It wwould be useful for Immich to have a way to directly access the OAuth login workflow through a URL or parameter (e.g. autoLaunch=1, i.e. the opposite of the action mentioned in https://immich.app/docs/administration/oauth#auto-launch).

Here's the use case I'm looking at:

  • Immich is linked into a Nextcloud instance through the 'External sites' app
  • Nextcloud acts as an OpenID Connect server using the OIDC app
  • Immich is configured to use this Nextcloud instance as OAuth provider
  • The web server is configured to allow embedding Immich from the Nextcloud domain
  • When the user activates the configured Immich instance by clicking on the icon in the Nextcloud header the Immich instance directly activates the OAuth login flow without having to press the 'Login with [Nextcloud instance name]' button
  • The user can directly interact with the logged-in Immich instance.

For an example of such a workflow have a look at what e.g. Peertube does when accessed through https://peertube.example.org/plugins/auth-openid-connect/0.1.3/auth/openid-connect - it does not show the login page but directly activates the OAuth login workflow, landing the user inside a logged-in instance.

This feature request aims to achieve the opposite of what featureFlags.oauthAutoLaunch enables in that it explicitly calls for autoLaunch on an instance which does not have this feature enabled instead of always using it with the option to disable it through the use of the autoLaunch=0 parameter. Adding an option to use autoLaunch=1 for the requested feature is probably the most clean way to do it, in ./src/routes/auth/login/+page.svelte (add a check for oauth.isAutoLaunchEnabled) and ./src/lib/utils.ts (add a test for isAutoLaunchEnabled)

How Has This Been Tested?

Tested using in-place edited JS files in the FF inspector for lack of a complete Immich build infrastructure.

API Changes

/auth/login?autoLaunch=1 - initiates OpenID Connect login process without the need for user interaction on systems which do not have OAuth Auto Launch enabled.

Checklist:

  • 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 followed naming conventions/patterns in the surrounding code

Yetangitu added 2 commits May 30, 2025 00:32
By launching Immich with `/auth/login?autoLaunch=1` an OpenID Connect login attempt is directly initated on installations where OAuth Auto Launch is not enabled. The intended use for this parameter is to enable Immich to be launched from e.g. Nextcloud using the _External sites_ app and the _oids_ OpenID Connect provider app so as to enable the user to directly interact with Immich without the need to press the `Login with ...` button.
@github-actions github-actions bot added documentation Improvements or additions to documentation 🖥️web labels May 29, 2025
Copy link
Member

@jrasm91 jrasm91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jrasm91 jrasm91 changed the title Direct OAuth login with /auth/login?autoLaunch=1 feat: start oauth with autoLaunch=1 May 30, 2025
Yetangitu added 2 commits May 30, 2025 20:37
_This could be a single line_

And now it is, as is its predecessor.
danieldietzler
danieldietzler previously approved these changes May 30, 2025
@danieldietzler danieldietzler dismissed their stale review May 30, 2025 21:22

Didn't mean to approve it yet, sorry.

@jrasm91 jrasm91 enabled auto-merge (squash) May 30, 2025 22:04
@jrasm91 jrasm91 merged commit e2defbc into immich-app:main May 30, 2025
46 checks passed
@Yetangitu Yetangitu deleted the oauth_autolaunch_parameter branch May 30, 2025 22:19
savely-krasovsky pushed a commit to savely-krasovsky/immich that referenced this pull request Jun 8, 2025
* Add automatic OpenID Connect login by using parameter `autoLaunch=1`

By launching Immich with `/auth/login?autoLaunch=1` an OpenID Connect login attempt is directly initated on installations where OAuth Auto Launch is not enabled. The intended use for this parameter is to enable Immich to be launched from e.g. Nextcloud using the _External sites_ app and the _oids_ OpenID Connect provider app so as to enable the user to directly interact with Immich without the need to press the `Login with ...` button.

* Add documentation for autolaunch by navigating to `/auth/login?autoLaunch=1`

* Look ma, no braces!

_This could be a single line_

And now it is, as is its predecessor.

* Change formatting to satisfy _prettier_

* if (condition) return true -> return condition

* More _prettier_ reformatting

* Look ma, braces!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:enhancement documentation Improvements or additions to documentation 🖥️web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants