fix: passkey failing on localhost other than 3000 (#103)

This commit is contained in:
Bereket Engida
2024-10-05 23:40:41 +03:00
committed by GitHub
parent 0ccf68ceed
commit b6353336d9
4 changed files with 5 additions and 8 deletions

View File

@@ -18,6 +18,7 @@ import { Checkbox } from "~/components/ui/checkbox";
import { Input } from "~/components/ui/input"; import { Input } from "~/components/ui/input";
import { Label } from "~/components/ui/label"; import { Label } from "~/components/ui/label";
import { signIn } from "~/lib/auth-client"; import { signIn } from "~/lib/auth-client";
import { PasswordInput } from "./ui/password-input";
export default function SignInCard() { export default function SignInCard() {
const [email, setEmail] = useState(""); const [email, setEmail] = useState("");
@@ -58,13 +59,13 @@ export default function SignInCard() {
Forgot your password? Forgot your password?
</Link> </Link>
</div> </div>
{/* <PasswordInput <PasswordInput
id="password" id="password"
value={password} value={password}
onChange={(e) => setPassword(e.target.value)} onChange={(e) => setPassword(e.target.value)}
autoComplete="password" autoComplete="password"
placeholder="Password" placeholder="Password"
/> */} />
</div> </div>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Checkbox <Checkbox

View File

@@ -1,5 +1,4 @@
{ {
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": { "compilerOptions": {
"allowJs": true, "allowJs": true,
"checkJs": true, "checkJs": true,

View File

@@ -1,6 +1,6 @@
{ {
"name": "better-auth", "name": "better-auth",
"version": "0.3.3-beta.5", "version": "0.3.3-beta.7",
"description": "The most comprehensive authentication library for TypeScript.", "description": "The most comprehensive authentication library for TypeScript.",
"type": "module", "type": "module",
"scripts": { "scripts": {

View File

@@ -76,10 +76,7 @@ export const passkey = (options?: PasskeyOptions) => {
const baseURL = process.env.BETTER_AUTH_URL; const baseURL = process.env.BETTER_AUTH_URL;
const rpID = const rpID =
options?.rpID || options?.rpID ||
baseURL baseURL?.replace("http://", "").replace("https://", "").split(":")[0] ||
?.replace("http://", "")
.replace("https://", "")
.replace(":3000", "") ||
"localhost"; "localhost";
if (!rpID) { if (!rpID) {
throw new BetterAuthError( throw new BetterAuthError(