docs: wrong phone number api

This commit is contained in:
Bereket Engida
2024-10-17 21:19:21 +03:00
parent 8bc293a0c9
commit cda582f339
2 changed files with 32 additions and 4 deletions

View File

@@ -89,6 +89,36 @@ export const auth = betterAuth({
passkey(),
bearer(),
admin(),
{
id: "last-login-ip",
hooks: {
after: [
{
matcher(context) {
return true;
},
async handler(ctx) {
const header = ctx.headers;
const response = ctx.context.returned;
if (response instanceof Response) {
const hasSetCookie = response.headers.get("set-cookie");
const hasSessionCookie = response.headers
.get("set-cookie")
?.includes("session_token");
if (hasSessionCookie) {
const ipAddress =
header?.get("x-forwarded-for") ||
header?.get("cf-connecting-ip");
if (ipAddress) {
//update the user's last login IP
}
}
}
},
},
],
},
},
],
socialProviders: {
github: {