mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
- examples: rename the user config module stack.ts/.tsx (and the convex/lovable
stack/ dirs) to hexclave and update all importers across .ts/.tsx/.jsx; the
public handler/[...stack] route segment is left unchanged.
- apps/{dashboard,backend,internal-tool}: rename app-local SDK-init symbols
(stackClientApp -> hexclaveClientApp, getStackServerApp -> getHexclaveServerApp)
and the dashboard StackCompanion component -> HexclaveCompanion. The public
StackClientApp/StackServerApp SDK classes are intentionally left unchanged.
- packages/stack-shared: add comments explaining why the crypto/JWT/vault
"stack-*" literals must NOT be renamed (key derivation / JWKS / KMS-alias
stability would break existing encrypted data and tokens).
Deliberately excluded: the STACK_* -> HEXCLAVE_* env-var rename (already works via
the dual-read layers; the docker post-build sentinel path is author-deferred), and
all public-contract names (SDK classes, env vars, HTTP headers, handler routes).
38 lines
1001 B
TypeScript
38 lines
1001 B
TypeScript
import { stackClientApp } from "./hexclave";
|
|
|
|
// Check if user is already signed in
|
|
stackClientApp.getUser().then((user) => {
|
|
if (user) {
|
|
window.location.href = "/";
|
|
}
|
|
});
|
|
|
|
// Handle Google Sign In
|
|
document.getElementById("googleSignIn")?.addEventListener("click", async () => {
|
|
try {
|
|
await stackClientApp.signInWithOAuth('google');
|
|
} catch (error) {
|
|
console.error("Google sign in failed:", error);
|
|
alert("Failed to initialize Google sign in");
|
|
}
|
|
});
|
|
|
|
// Handle OAuth redirect
|
|
window.addEventListener("load", async () => {
|
|
try {
|
|
const params = new URLSearchParams(window.location.search);
|
|
const code = params.get("code");
|
|
const state = params.get("state");
|
|
|
|
if (code && state) {
|
|
const user = await stackClientApp.callOAuthCallback();
|
|
if (user) {
|
|
window.location.href = "/";
|
|
}
|
|
}
|
|
} catch (error) {
|
|
console.error("Failed to handle OAuth redirect:", error);
|
|
alert("Authentication failed. Please try again.");
|
|
}
|
|
});
|