LibreChat/api/strategies
Ventz Petkov f380f261a5
🛂 fix: OIDC Username Array Edge Case (#2394)
* Patch for OpenID username

`username` is generally based on email, rather than `given_name`. The challenge with `given_name` is that it can be a multi-value array (ex: "Nick, Fullname"), which completely breaks the system with: 

```
LibreChat      | ValidationError: User validation failed: username: Cast to string failed for value "[ 'Nickname', 'Firstname' ]" (type Array) at path "username"
LibreChat      |     at Document.invalidate (/app/node_modules/mongoose/lib/document.js:3200:32)
LibreChat      |     at model.$set (/app/node_modules/mongoose/lib/document.js:1459:12)
LibreChat      |     at model.set [as username] (/app/node_modules/mongoose/lib/helpers/document/compile.js:205:19)
LibreChat      |     at OpenIDConnectStrategy._verify (/app/api/strategies/openidStrategy.js:127:27)
LibreChat      |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
```

* Update openidStrategy.js

* refactor(openidStrategy): add helper function for stringy username

---------

Co-authored-by: Danny Avila <danny@librechat.ai>
2024-04-12 12:39:11 -04:00
..
discordStrategy.js 🚀 Feat: Streamline File Strategies & GPT-4-Vision Settings (#1535) 2024-01-11 11:37:54 -05:00
facebookStrategy.js 🚀 Feat: Streamline File Strategies & GPT-4-Vision Settings (#1535) 2024-01-11 11:37:54 -05:00
githubStrategy.js 🚀 Feat: Streamline File Strategies & GPT-4-Vision Settings (#1535) 2024-01-11 11:37:54 -05:00
googleStrategy.js 🚀 Feat: Streamline File Strategies & GPT-4-Vision Settings (#1535) 2024-01-11 11:37:54 -05:00
index.js chore: remove jose as Bun now supports JWT 🍞 (#1167) 2023-11-12 00:44:46 -05:00
joseStrategy.js refactor(api): Central Logging 📜 (#1348) 2023-12-14 07:49:27 -05:00
jwtStrategy.js refactor(api): Central Logging 📜 (#1348) 2023-12-14 07:49:27 -05:00
localStrategy.js 🅰️ feat: Azure Config to Allow Different Deployments per Model (#1863) 2024-02-26 14:12:25 -05:00
openidStrategy.js 🛂 fix: OIDC Username Array Edge Case (#2394) 2024-04-12 12:39:11 -04:00
process.js feat: Assistants API, General File Support, Side Panel, File Explorer (#1696) 2024-02-13 20:42:27 -05:00
validators.js 🌍 feat: Extend regex to support international usernames (#1918) 2024-02-28 14:27:57 -05:00
validators.spec.js 🌍 feat: Extend regex to support international usernames (#1918) 2024-02-28 14:27:57 -05:00