mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
convex fix auth config bug (#1031)
<!-- Make sure you've read the CONTRIBUTING.md guidelines: https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added new `./convex-auth.config` export path for Convex authentication configuration across all packages. * **Documentation** * Updated documentation and examples with new import paths for Convex auth integration in JavaScript, React, and Next.js projects. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
2cb8806193
commit
a6bf1e8ae8
@ -1,4 +1,4 @@
|
||||
import { getConvexProvidersConfig } from "@stackframe/stack";
|
||||
import { getConvexProvidersConfig } from "@stackframe/stack/convex-auth.config";
|
||||
|
||||
export default {
|
||||
providers: getConvexProvidersConfig({
|
||||
|
||||
@ -23,6 +23,15 @@
|
||||
"require": {
|
||||
"default": "./dist/integrations/convex/component/convex.config.js"
|
||||
}
|
||||
},
|
||||
"./convex-auth.config": {
|
||||
"types": "./dist/integrations/convex.d.ts",
|
||||
"import": {
|
||||
"default": "./dist/esm/integrations/convex.js"
|
||||
},
|
||||
"require": {
|
||||
"default": "./dist/integrations/convex.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"homepage": "https://stack-auth.com",
|
||||
|
||||
@ -23,6 +23,15 @@
|
||||
"require": {
|
||||
"default": "./dist/integrations/convex/component/convex.config.js"
|
||||
}
|
||||
},
|
||||
"./convex-auth.config": {
|
||||
"types": "./dist/integrations/convex.d.ts",
|
||||
"import": {
|
||||
"default": "./dist/esm/integrations/convex.js"
|
||||
},
|
||||
"require": {
|
||||
"default": "./dist/integrations/convex.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"homepage": "https://stack-auth.com",
|
||||
|
||||
@ -23,6 +23,15 @@
|
||||
"require": {
|
||||
"default": "./dist/integrations/convex/component/convex.config.js"
|
||||
}
|
||||
},
|
||||
"./convex-auth.config": {
|
||||
"types": "./dist/integrations/convex.d.ts",
|
||||
"import": {
|
||||
"default": "./dist/esm/integrations/convex.js"
|
||||
},
|
||||
"require": {
|
||||
"default": "./dist/integrations/convex.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"homepage": "https://stack-auth.com",
|
||||
|
||||
@ -33,6 +33,15 @@
|
||||
"require": {
|
||||
"default": "./dist/integrations/convex/component/convex.config.js"
|
||||
}
|
||||
},
|
||||
"./convex-auth.config": {
|
||||
"types": "./dist/integrations/convex.d.ts",
|
||||
"import": {
|
||||
"default": "./dist/esm/integrations/convex.js"
|
||||
},
|
||||
"require": {
|
||||
"default": "./dist/integrations/convex.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"homepage": "https://stack-auth.com",
|
||||
|
||||
@ -24,6 +24,15 @@
|
||||
"require": {
|
||||
"default": "./dist/integrations/convex/component/convex.config.js"
|
||||
}
|
||||
},
|
||||
"./convex-auth.config": {
|
||||
"types": "./dist/integrations/convex.d.ts",
|
||||
"import": {
|
||||
"default": "./dist/esm/integrations/convex.js"
|
||||
},
|
||||
"require": {
|
||||
"default": "./dist/integrations/convex.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"homepage": "https://stack-auth.com",
|
||||
|
||||
@ -17,9 +17,9 @@ npx @stackframe/init-stack@latest
|
||||
Next, update or create a file in `convex/auth.config.ts`:
|
||||
|
||||
```ts
|
||||
import { getConvexProvidersConfig } from "@stackframe/js"; // Vanilla JS
|
||||
// or: import { getConvexProvidersConfig } from "@stackframe/react"; // React
|
||||
// or: import { getConvexProvidersConfig } from "@stackframe/stack"; // Next.js
|
||||
import { getConvexProvidersConfig } from "@stackframe/js/convex-auth.config"; // Vanilla JS
|
||||
// or: import { getConvexProvidersConfig } from "@stackframe/react/convex-auth.config"; // React
|
||||
// or: import { getConvexProvidersConfig } from "@stackframe/stack/convex-auth.config"; // Next.js
|
||||
|
||||
export default {
|
||||
providers: getConvexProvidersConfig({
|
||||
|
||||
@ -13,7 +13,7 @@ import { TeamsCrud } from "@stackframe/stack-shared/dist/interface/crud/teams";
|
||||
import { UsersCrud } from "@stackframe/stack-shared/dist/interface/crud/users";
|
||||
import { InternalSession } from "@stackframe/stack-shared/dist/sessions";
|
||||
import type { AsyncCache } from "@stackframe/stack-shared/dist/utils/caches";
|
||||
import { StackAssertionError, throwErr } from "@stackframe/stack-shared/dist/utils/errors";
|
||||
import { captureError, StackAssertionError, throwErr } from "@stackframe/stack-shared/dist/utils/errors";
|
||||
import { ProviderType } from "@stackframe/stack-shared/dist/utils/oauth";
|
||||
import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises";
|
||||
import { suspend } from "@stackframe/stack-shared/dist/utils/react";
|
||||
@ -35,6 +35,7 @@ import { ProjectCurrentServerUser, ServerOAuthProvider, ServerUser, ServerUserCr
|
||||
import { StackServerAppConstructorOptions } from "../interfaces/server-app";
|
||||
import { _StackClientAppImplIncomplete } from "./client-app-impl";
|
||||
import { clientVersion, createCache, createCacheBySession, getBaseUrl, getDefaultExtraRequestHeaders, getDefaultProjectId, getDefaultPublishableClientKey, getDefaultSecretServerKey, resolveConstructorOptions } from "./common";
|
||||
import { startRegistration, WebAuthnError } from "@simplewebauthn/browser";
|
||||
|
||||
import { useAsyncCache } from "./common"; // THIS_LINE_PLATFORM react-like
|
||||
|
||||
@ -731,15 +732,12 @@ export class _StackServerAppImplIncomplete<HasTokenStore extends boolean, Projec
|
||||
|
||||
let attResp;
|
||||
try {
|
||||
const { startRegistration } = await import("@simplewebauthn/browser");
|
||||
attResp = await startRegistration({ optionsJSON: options_json });
|
||||
} catch (error: any) {
|
||||
const { WebAuthnError } = await import("@simplewebauthn/browser");
|
||||
if (error instanceof WebAuthnError) {
|
||||
return Result.error(new KnownErrors.PasskeyWebAuthnError(error.message, error.name));
|
||||
} else {
|
||||
// This should never happen
|
||||
const { captureError } = await import("@stackframe/stack-shared/dist/utils/errors");
|
||||
captureError("passkey-registration-failed", error);
|
||||
return Result.error(new KnownErrors.PasskeyRegistrationFailed("Failed to start passkey registration due to unknown error"));
|
||||
}
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
import createJsLibraryTsupConfig from '../../configs/tsup/js-library';
|
||||
|
||||
export default createJsLibraryTsupConfig({ barrelFiles: ["src/index.ts", "src/integrations/convex/component/convex.config.ts"] });
|
||||
export default createJsLibraryTsupConfig({ barrelFiles: [
|
||||
"src/index.ts",
|
||||
"src/integrations/convex/component/convex.config.ts",
|
||||
"src/integrations/convex.ts",
|
||||
] });
|
||||
|
||||
Loading…
Reference in New Issue
Block a user