OIDC/SSO flow drops invite code context (multi-community auto-join issue)

(#4737) Bug Open: Awaiting confirmation desktop self-hosting

Thread

Comment by errno0x0d
errno0x0d OP1 vote
Implementation suggestion to easily fix this:
  1. In the client apps (Web, Desktop, Mobile): When an unauthenticated visitor clicks "Login with SSO" on an /invite/:code landing screen, ensure POST /v1/auth/sso/start includes redirect_to: window.location.pathname (or an explicit invite_code parameter) so it gets preserved in the OAuth statePayload.
  1. In SsoService (completeLogin / resolveUserFromClaims): Extract the invite code from statePayload.redirectTo if it matches /invite/:code and prioritize it:
const inviteMatch = statePayload.redirectTo?.match(/\/invite\/([a-zA-Z0-9_-]+)/);
const inviteCodeToJoin = inviteMatch ? inviteMatch[1] : autoJoinInviteCode;

if (inviteCodeToJoin) {
  await maybeAutoJoinInvite(this.inviteService, {
    userId: user.id,
    inviteCode: inviteCodeToJoin,
    requestCache
  });
}
This ensures the user seamlessly lands inside the specific invited guild across all platforms, while preserving the static FLUXER_AUTO_JOIN_INVITE_CODE fallback for generic root signups.