mirror of
https://github.com/immich-app/immich
synced 2025-06-06 20:58:30 +00:00
feat: start oauth with autoLaunch=1
(#18763)
* 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!
This commit is contained in:
parent
f4e4e6628e
commit
e2defbc49a
@ -93,6 +93,7 @@ The `.well-known/openid-configuration` part of the url is optional and will be a
|
||||
## Auto Launch
|
||||
|
||||
When Auto Launch is enabled, the login page will automatically redirect the user to the OAuth authorization url, to login with OAuth. To access the login screen again, use the browser's back button, or navigate directly to `/auth/login?autoLaunch=0`.
|
||||
Auto Launch can also be enabled on a per-request basis by navigating to `/auth/login?authLaunch=1`, this can be useful in situations where Immich is called from e.g. Nextcloud using the _External sites_ app and the _oidc_ app so as to enable users to directly interact with a logged-in instance of Immich.
|
||||
|
||||
## Mobile Redirect URI
|
||||
|
||||
|
@ -275,6 +275,10 @@ export const oauth = {
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isAutoLaunchEnabled: (location: Location) => {
|
||||
const value = 'autoLaunch=1';
|
||||
return location.search.includes(value);
|
||||
},
|
||||
authorize: async (location: Location) => {
|
||||
const $t = get(t);
|
||||
try {
|
||||
|
@ -53,7 +53,10 @@
|
||||
}
|
||||
|
||||
try {
|
||||
if ($featureFlags.oauthAutoLaunch && !oauth.isAutoLaunchDisabled(globalThis.location)) {
|
||||
if (
|
||||
($featureFlags.oauthAutoLaunch && !oauth.isAutoLaunchDisabled(globalThis.location)) ||
|
||||
oauth.isAutoLaunchEnabled(globalThis.location)
|
||||
) {
|
||||
await goto(`${AppRoute.AUTH_LOGIN}?autoLaunch=0`, { replaceState: true });
|
||||
await oauth.authorize(globalThis.location);
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user