markbates / goth

Package goth provides a simple, clean, and idiomatic way to write authentication packages for Go web applications.
https://blog.gobuffalo.io/goth-needs-a-new-maintainer-626cd47ca37b
MIT License
5.19k stars 565 forks source link

Empty claims with OIDC provider on Authentik #561

Open tboerger opened 3 weeks ago

tboerger commented 3 weeks ago

I try to implement Goth with generic OIDC providers like Authentik. The configurations for GitHub, AzureAD and Keycloak are working totally finbe, but with Authentik and the configuration below results in empty claims as I don't get a nickname, email or name of the authenticated user.

Has somebody else faced this issue and got an idea how to resolve that? If there is some information missing I try my best to deliver the missing parts.

    provider, err := openidConnect.NewNamed(
        "authentik",
        "REDACTED",
        "REDACTED",
        "http://localhost:8080/api/v1/auth/authentik-oidc/callback",
        "https://authentik.example.com/application/o/example/.well-known/openid-configuration",
        []string{},
    )

    if err != nil {
        return nil, err
    }

    provider.NickNameClaims = []string{
        "preferred_username",
    }

    provider.NameClaims = []string{
        "name",
    }

    provider.EmailClaims = []string{
        "email",
    }
tboerger commented 3 weeks ago

I have also tried it with the discovery URL set to https://authentik.example.com/application/o/example/ which got the same result.