mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
Apple's Sign in with Apple is OIDC-compatible, so it works through Wekan's existing generic OAuth2/OIDC client - except its "client secret" is not a static string: it must be a short-lived JWT the server signs itself (ES256), using a private key downloaded from Apple's developer portal. Every other generic OAuth2 provider Wekan supports (Keycloak, Authelia, Nextcloud, ...) keeps sending its static OAUTH2_SECRET unchanged. models/lib/oauth2ClientSecretJwt.js mints that JWT using only Node's built-in crypto module (no new dependency: ES256 signing with IEEE-P1363 signature encoding has been supported since Node 12). It is opt-in: when OAUTH2_SECRET_JWT_KEY_PATH is unset (the default, and every existing provider's configuration), maybeGenerateOauth2ClientSecretJwt() returns null and packages/wekan-oidc/oidc_server.js falls back to the static OAUTH2_SECRET exactly as before. Apple's other quirk - it returns the user's name only on the very first authorization - needs no special-casing: Accounts.onCreateUser (server/models/users.js) already copies the OIDC fullname/email claims into the user's profile only once, at account creation, and never overwrites them on later logins (Meteor's updateOrCreateUserFromExternalService only touches services.oidc.* for a returning user, not profile.*). docs/Features/Login/Apple.md documents Apple's endpoints and the new env vars, mirroring the Keycloak/Authelia docs pattern. Thanks to xet7 ! Closes #2458,