fix: passkey rpID default

This commit is contained in:
Bereket Engida
2024-09-17 12:44:48 +03:00
parent 444a40686b
commit 6c98c6a4c6
2 changed files with 5 additions and 4 deletions

View File

@@ -66,9 +66,7 @@ export const auth = betterAuth({
},
},
}),
passkey({
rpID: "localhost",
}),
passkey(),
],
socialProvider: [
github({

View File

@@ -72,7 +72,10 @@ export type Passkey = {
export const passkey = (options?: PasskeyOptions) => {
const baseURL = process.env.BETTER_AUTH_URL;
const rpID = options?.rpID || baseURL || "localhost";
const rpID =
options?.rpID ||
baseURL?.replace("http://", "").replace("https://", "") ||
"localhost";
if (!rpID) {
throw new BetterAuthError(
"passkey rpID not found. Please provide a rpID in the options or set the BETTER_AUTH_URL environment variable.",