Skip to content

loadUserInfo is hardcoded to true, ignoring user configuration #46

Description

@hannal

Description

In lib/src/zitadelAuth.ts, the loadUserInfo option is hardcoded to true when creating the UserManager instance:

const userManager = new UserManager({
  userStore: new WebStorageStateStore({ store: window.localStorage }),
  loadUserInfo: true,  // hardcoded
  ...authConfig,
  });

Environment

@zitadel/react: 1.1.0

Describe the problem caused by this code

Since ZitadelConfig extends Partial, users should be able to configure loadUserInfo, but the hardcoded value prevents this.

Why this matters

  1. Unnecessary network requests: Users who enable "User Info inside ID Token" in ZITADEL console don't need to call the userinfo endpoint, but they can't disable it.
  2. Flexibility: According to https://authts.github.io/oidc-client-ts/interfaces/UserManagerSettings.html, loadUserInfo defaults to false. The SDK should respect user configuration while providing a sensible default for ZITADEL.
  3. ZITADEL configuration options: As per https://zitadel.com/docs/apis/openidoauth/endpoints, users can enable id_token_userinfo_assertion ("User Info inside ID Token") to include user claims directly in the ID token, making the userinfo endpoint call redundant.

Expected behavior

Users should be able to set loadUserInfo: false in their ZitadelConfig when they have "User Info inside ID Token" enabled in ZITADEL.

Suggested fix

const userManager = new UserManager({
  userStore: new WebStorageStateStore({ store: window.localStorage }),
  loadUserInfo: zitadelConfig.loadUserInfo ?? true,
  ...authConfig,
});

This maintains backward compatibility (defaults to true) while allowing users to override the setting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    Status
    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions