better-auth-vercel-geolocation 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# better-auth-vercel-geolocation
|
|
2
2
|
|
|
3
|
-
A [better-auth](https://www.better-auth.com/) plugin that enriches the auth session with Vercel edge geolocation data. On session create and refresh, it reads the [`x-vercel-ip-*` headers](https://vercel.com/docs/
|
|
3
|
+
A [better-auth](https://www.better-auth.com/) plugin that enriches the auth session with Vercel edge geolocation data. On session create and refresh, it reads the [`x-vercel-ip-*` headers](https://vercel.com/docs/headers/request-headers) via `@vercel/functions` server-side and writes the configured fields into the session record — no browser permission prompt, no extra API call.
|
|
4
4
|
|
|
5
5
|
> [!NOTE]
|
|
6
6
|
> Requires deployment on Vercel. In local development, geo fields will be `undefined`.
|
|
@@ -9,7 +9,7 @@ A [better-auth](https://www.better-auth.com/) plugin that enriches the auth sess
|
|
|
9
9
|
|
|
10
10
|
- **Zero-config defaults** — stores city, country, countryRegion and flag out of the box
|
|
11
11
|
- **Configurable fields** — pick exactly which [geo fields](https://vercel.com/docs/edge-network/headers#x-vercel-ip-city) you need
|
|
12
|
-
- **Auto-refresh** —
|
|
12
|
+
- **Auto-refresh** — Updates geo data when the session refreshes
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
@@ -25,7 +25,7 @@ Requires **better-auth** >= 1.4.18 as a peer dependency.
|
|
|
25
25
|
|
|
26
26
|
```ts
|
|
27
27
|
import { betterAuth } from 'better-auth';
|
|
28
|
-
import { geolocation } from 'better-auth-
|
|
28
|
+
import { geolocation } from 'better-auth-vercel-geolocation';
|
|
29
29
|
|
|
30
30
|
export const auth = betterAuth({
|
|
31
31
|
plugins: [geolocation()],
|
|
@@ -42,7 +42,7 @@ npx @better-auth/cli migrate
|
|
|
42
42
|
|
|
43
43
|
```ts
|
|
44
44
|
import { createAuthClient } from 'better-auth/react';
|
|
45
|
-
import { geolocationClient } from 'better-auth-
|
|
45
|
+
import { geolocationClient } from 'better-auth-vercel-geolocation/client';
|
|
46
46
|
|
|
47
47
|
export const authClient = createAuthClient({
|
|
48
48
|
plugins: [geolocationClient()],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-auth-vercel-geolocation",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A better-auth plugin that enriches sessions with Vercel edge geolocation data.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/weepaho3/better-auth-vercel-geolocation",
|
|
@@ -59,13 +59,15 @@
|
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "bunchee",
|
|
61
61
|
"clean": "rm -rf dist",
|
|
62
|
-
"type-check": "tsc --noEmit"
|
|
62
|
+
"type-check": "tsc --noEmit",
|
|
63
|
+
"release": "semantic-release"
|
|
63
64
|
},
|
|
64
65
|
"dependencies": {
|
|
65
66
|
"@vercel/functions": "^3.4.3"
|
|
66
67
|
},
|
|
67
68
|
"devDependencies": {
|
|
68
69
|
"bunchee": "^6.9.3",
|
|
70
|
+
"semantic-release": "^25.0.3",
|
|
69
71
|
"typescript": "^5.7.2"
|
|
70
72
|
},
|
|
71
73
|
"peerDependencies": {
|