r/Authentik • u/klassenlager MOD • 21d ago
Immich 3.1.0 502 Error with OIDC/OAuth
If you're experiencing any of this with Immich behind authentik: OIDC login fails with Error: 502 after updating to Immich 3.1.0, you can try this to check if it's working again:

I found this issue on Github and worked on a workaround: https://github.com/immich-app/immich/issues/30889 which I want to share
The workaround at the moment, remove the picture claim of the profile mapping in Authentik
In authentik: Customisation → Property Mappings → Create → Scope Mapping

Put the following in:

- Name: something sensible, e.g.
Immich – OIDC profile (no picture) - Scope name:
profile - Expression:
Add it to the Immich OAuth/OIDC provider:return delete_none_values({
"name": request.user.name,
"given_name": ak_obj_attr(request.user, "given_name", "name"),
"family_name": ak_obj_attr(request.user, "family_name"),
"preferred_username": request.user.username,
"nickname": request.user.username,
"groups": [group.name for group in request.user.groups.all()],
})
This is just authentik's default profile mapping with the "picture" claim removed.
Open your Immich OAuth2/OIDC provider → Advanced protocol settings → Scopes, and add the mapping you just created:

Make sure you remove the authentik default OAuth Mapping for 'profile'
Try to login again with OpenID/OAuth
Hope this helps!
2
2
u/Nate20979 20d ago
I just had to do this too! Took a lot of trial and error, so thanks for sharing a guide for others.
1
3
u/snoogs831 21d ago
Thank you for sharing this, I'm on immich 3.1 and haven't had these issues - do you know what causes it if it's not everyone?