mirror of
https://github.com/svemagie/indiekit-endpoint-activitypub.git
synced 2026-04-02 15:44:58 +02:00
MongoDB sparse indexes skip documents where the indexed field is ABSENT, but still enforce uniqueness on explicit null values. The auth code insert set accessToken:null and the client_credentials insert set code:null, causing E11000 duplicate key errors on the second authorization attempt. Fix: omit accessToken/code entirely from inserts where they don't apply. The field gets added later during token exchange ($set in updateOne).