I
Immich3y ago
Jiibus

Connecting to Authentik

Continuing on from general-discussion
59 Replies
Jiibus
JiibusOP3y ago
So it doesn't know where to find authentik
No description
Jiibus
JiibusOP3y ago
But the base domain it sees the cloudflare IP
jrasm91
jrasm913y ago
And this isn't the url you used in the issuer url? Was that the base domain?
Jiibus
JiibusOP3y ago
The issuer URL is my first query without the path after, obviously
jrasm91
jrasm913y ago
I'm confused
Jiibus
JiibusOP3y ago
Apologies, what am I not stating correctly?
jrasm91
jrasm913y ago
When you click the login with Authentik button you are directed to Authentik successfully?
Jiibus
JiibusOP3y ago
Yes But then I go right back to the immich login
jrasm91
jrasm913y ago
That implies that immich loaded the discovery document successfully Which means it resolved the domain and URL you used in the issuer url in immich
Jiibus
JiibusOP3y ago
Would authentik be handling all that?
jrasm91
jrasm913y ago
Immich send a request to the discovery document first, then redirects the user, and finally called back to Authentik one more time to confirm a code. This looks like a network error during step three But it is weird that step one worked successfully, when it should be making a request to the same domain
Jiibus
JiibusOP3y ago
The URL I get after I login with authentik has the path /auth/login?code=XXX&state=XXX The immich URL I mean Not literally "XXXX" to be clear
jrasm91
jrasm913y ago
Yup and then immich needs to send the code to Authentik After that oauth is successful and you'll be logged in
Jiibus
JiibusOP3y ago
I get the Error: getaddrinfo ENOTFOUND again This might be some truenas scale fuckery I should clarify that this URL shows on immich login page after authentik.
jrasm91
jrasm913y ago
In the immich oauth settings you are using auth.donain.com?
Jiibus
JiibusOP3y ago
Correct I might just have to ask the Truecharts people because this seems like something they'd know
jrasm91
jrasm913y ago
I'm not sure how you are even getting redirected in the first place, but this seems like a networking issue
Jiibus
JiibusOP3y ago
truecharts are the group that does a 3rd party repo for truenas scale and both immich & authentik are their apps
jrasm91
jrasm913y ago
Yeah, some people here have used it. Not sure of with oauth specifically or not Do you need to do anything special to let the two apps talk to each other internally?
Jiibus
JiibusOP3y ago
I appreciate your time. I think you're right in the networking issue. Probably some kubernetes deal, which I'm not familiar with yet Normally when I want this, I use the internal kubernetes address I gave you earlier
Jiibus
JiibusOP3y ago
No description
jrasm91
jrasm913y ago
Where do you setup DNS for your domains? Do you have split DNS?
Jiibus
JiibusOP3y ago
There's a scale app that handles the DNS for apps. I set the subdomain.domain.tld in the app set up and it automatically translates. it's worked fine for me thus far
jrasm91
jrasm913y ago
Do those apps use Authentik?
Jiibus
JiibusOP3y ago
Not all of them, I have mostly the *arr apps using it and nextcloud
jrasm91
jrasm913y ago
Just because I would imagine the setup/network requirements are the same
Jiibus
JiibusOP3y ago
Yea nextcloud setup worked fine, but I followed a guide. Lemme look at the saml settings of nextcloud
jrasm91
jrasm913y ago
I'd assume your DNS would resolve the auth domain successfully for immich as that seems to be the only problem.
Jiibus
JiibusOP3y ago
Yea that uses the public domain names in its config
jrasm91
jrasm913y ago
Next cloud isn't attached to a special network is it?
Jiibus
JiibusOP3y ago
it's part of the same setup as immich
jrasm91
jrasm913y ago
Sometimes there are internal and external networks
Jiibus
JiibusOP3y ago
They're all in their little kubernetes space, whatever it's called. I'll stop taking up your time since this really does look like something outside of immich. I thank you very much for helping me understand this much
jrasm91
jrasm913y ago
Sounds good and good luck. I think as soon as immich can talk to that subdomain you'll be all set. Could always try restarting stuff lol.
spaceb0t
spaceb0t3y ago
found this thread trying to get SSO working from the mobile app, couple of clarifications: - Authentik works fine with Immich using OAuth2 on TrueNAS with proper settings - The "Scale" app for DNS that OP is referring to is just Traefik
spaceb0t
spaceb0t3y ago
for OP - the settings for Immich OAuth2 in Authentik are more or less the same as Portainer, try this guide from the docs: https://goauthentik.io/integrations/services/portainer/
Portainer | authentik
Support level: Community
jrasm91
jrasm913y ago
Did you get it working for mobile?
spaceb0t
spaceb0t3y ago
yeah, took me a bit to find the right url
jrasm91
jrasm913y ago
What do you mean?
spaceb0t
spaceb0t3y ago
i just had to put https://my.immichsite.com/api as the end point, which is what is listed as default, but I didn't see it until I had tried a bunch of other ones
jrasm91
jrasm913y ago
Ah, gotcha.
spaceb0t
spaceb0t3y ago
FWIW - Authentik does support the return URI app.immich:/ but you have to input it manually in the Authentik settings It seems that once Immich connects the first time with .../o/immich/.well-known/... that it doesn't automatically add a 2nd return URI for mobile so you have to make sure both are listed in Authentik, manually: https://cdn.securelink.to/u/EIQ9tv.png
jrasm91
jrasm913y ago
What do you mean by this? Should Authentik support the mobile redirect URI without manually adding it?
spaceb0t
spaceb0t3y ago
Authentik generates 2 configuration links for OAuth2. By using the /.well-known/ link in the Immich OAuth2 config section, upon first connection, Immich pushes basic config info back to Authentik (like the redirect URI). However, since the mobile app has a different redirect, it's not going to get automatically populated I'm not smart enough to know if it can be done automatically, I just figured I'd post the solution for the next person who comes searching for it
jrasm91
jrasm913y ago
I don't think immich ever updates the configuration in Authentik, it just consumes the settings.
spaceb0t
spaceb0t3y ago
well, i suppose it's a matter of symantics...maybe it's better to say - "Authentik grabs the redirect URL"
jrasm91
jrasm913y ago
Usually all of the redirect URIs have to be manually registered when the app is configurer on the OAuth server. Immich specifies which redirect URI attention should use depending where you login from
spaceb0t
spaceb0t3y ago
yeah, i used to think so too, but then suddenly they started magically appearing in Authentik ¯\_(ツ)_/¯
jrasm91
jrasm913y ago
You didn't add the /auth/login one?
spaceb0t
spaceb0t3y ago
no
spaceb0t
spaceb0t3y ago
here's the full text under that last screenshot: https://cdn.securelink.to/u/CSdD8a.png
jrasm91
jrasm913y ago
Interesting
spaceb0t
spaceb0t3y ago
magic 🙂
jrasm91
jrasm913y ago
It's a Authentik feature lol
spaceb0t
spaceb0t3y ago
yeah, appears so
jrasm91
jrasm913y ago
That's good to know. Unfortunately you can only send one redirect URI per login request
jrasm91
jrasm913y ago
OAuth Authentication | Immich
This page contains details about using OAuth in Immich.
spaceb0t
spaceb0t3y ago
i did not actually look at the immich docs, I already knew which Authentik fields to post where based on the field names
jrasm91
jrasm913y ago
Cool, sounds good.

Did you find this page helpful?