Skip to content

Conversation

@RyanHecht
Copy link
Contributor

Add emailclaim configuration option to openid auth providers to specify an alternative claim to use as the user's email address. This is useful for environments like Azure AD where the standard email claim may not be available or configurable per-app.

The emailclaim option can be set to use claims like 'upn' (User Principal Name) or any other claim containing a unique identifier in email format.

Add configuration option to specify an alternative claim to use as the user's email address. This is useful for environments like Azure AD where the standard email claim may not be available or configurable per-app.

The emailclaim option can be set to use claims like 'upn' (User Principal Name) or any other claim containing a unique identifier in email format.
@RyanHecht
Copy link
Contributor Author

RyanHecht commented Dec 8, 2025

I run an organization that uses a free tier Azure AD/Entra ID tenant. Not everybody has the email claim filled in, since by default this is only done for those with Outlook licenses.

Vikunja requires the email claim be provided, else users receive an error when they log in.

I cannot modify the email claim to point to the upn claim for the Vikunja application registration, because email is a "restricted claim" that cannot be modified by an app, as explained in this Stack Exchange post.

So, I (with the assistance of Claude Opus 4.5 via GitHub Copilot CLI) added a new option to the OpenID auth provider config: emailclaim. This allows

In my deployment, I've set emailclaim: upn to allow users without email addresses in Azure AD/Entra ID to still be able to log into Vikunja without getting an error.

I'm not married to the name emailclaim, I would accept any changes.

I'll also note that I'm not a Go developer by day, and Copilot (via Opus) did most of the heavy lifting.

}

// TestExtractCustomEmailClaim tests extracting email from a custom claim
func TestExtractCustomEmailClaim(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

These tests just duplicate the logic in the test and are therefore not very useful since they don't test the actual logic. Please modify them accordingly.

{
"key": "emailclaim",
"default_value": "",
"comment": "This option allows specifying an alternative claim to use as the user's email address. By default, Vikunja uses the standard `email` claim. In environments like Azure AD where users may not have email addresses configured or the email claim cannot be modified per-app, you can set this to use a different claim such as `upn` (User Principal Name) or any other claim that contains a unique identifier in email format. The claim value should be a valid email-like string that can be used to identify the user."
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"comment": "This option allows specifying an alternative claim to use as the user's email address. By default, Vikunja uses the standard `email` claim. In environments like Azure AD where users may not have email addresses configured or the email claim cannot be modified per-app, you can set this to use a different claim such as `upn` (User Principal Name) or any other claim that contains a unique identifier in email format. The claim value should be a valid email-like string that can be used to identify the user."
"comment": "This option allows specifying an alternative claim to use as the user's email address if the default claim is empty or not present. By default, Vikunja uses the standard `email` claim. In environments like Azure AD where users may not have email addresses configured or the email claim cannot be modified per-app, you can set this to use a different claim such as `upn` (User Principal Name) or any other claim that contains a unique identifier in email format. The claim value should be a valid email-like string that can be used to identify the user."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants