@checkstack/auth-backend 0.4.9 → 0.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @checkstack/auth-backend
2
2
 
3
+ ## 0.4.10
4
+
5
+ ### Patch Changes
6
+
7
+ - eb353a4: Fix TypeError in better-auth initialization when LDAP or SAML strategies are enabled. Non-social strategies are now correctly filtered out from the socialProviders configuration, and standard social providers (GitHub) are correctly initialized using their respective factory functions.
8
+
3
9
  ## 0.4.9
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/auth-backend",
3
- "version": "0.4.9",
3
+ "version": "0.4.10",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { betterAuth } from "better-auth";
2
+ import * as socialProviderFactories from "better-auth/social-providers";
2
3
  import { drizzleAdapter } from "better-auth/adapters/drizzle";
3
4
  import { APIError } from "better-auth/api";
4
5
  import {
@@ -515,10 +516,23 @@ export default createBackendPlugin({
515
516
  strategy.id
516
517
  }: ${Object.keys(strategyConfig || {}).join(", ")}`,
517
518
  );
518
- socialProviders[strategy.id] = strategyConfig;
519
- logger.debug(
520
- `[auth-backend] -> Added ${strategy.id} to socialProviders`,
521
- );
519
+
520
+ const providerFactory = (
521
+ socialProviderFactories as Record<string, unknown>
522
+ )[strategy.id];
523
+
524
+ if (typeof providerFactory === "function") {
525
+ socialProviders[strategy.id] = (
526
+ providerFactory as (options: unknown) => unknown
527
+ )(strategyConfig);
528
+ logger.debug(
529
+ `[auth-backend] -> ✅ Added ${strategy.id} to socialProviders`,
530
+ );
531
+ } else {
532
+ logger.debug(
533
+ `[auth-backend] -> Strategy ${strategy.id} is not a standard social provider, skipping better-auth registration`,
534
+ );
535
+ }
522
536
  }
523
537
 
524
538
  // Check if credential strategy is enabled from meta config