@better-auth/expo 1.5.0-beta.2 → 1.5.0-beta.3
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/LICENSE.md +15 -12
- package/README.md +40 -29
- package/dist/index.d.mts +7 -0
- package/package.json +6 -9
package/LICENSE.md
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
Copyright (c) 2024 - present, Bereket Engida
|
|
3
3
|
|
|
4
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
-
and associated documentation files (the
|
|
6
|
-
including without limitation the rights to
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
+
this software and associated documentation files (the “Software”), to deal in
|
|
6
|
+
the Software without restriction, including without limitation the rights to
|
|
7
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
8
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
9
|
+
subject to the following conditions:
|
|
9
10
|
|
|
10
|
-
The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
substantial portions of the Software.
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
12
13
|
|
|
13
|
-
THE SOFTWARE IS PROVIDED
|
|
14
|
-
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
16
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
18
|
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
19
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
20
|
+
DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Better Auth Expo Plugin
|
|
2
2
|
|
|
3
|
-
This plugin integrates Better Auth with Expo, allowing you to easily add
|
|
3
|
+
This plugin integrates Better Auth with Expo, allowing you to easily add
|
|
4
|
+
authentication to your Expo (React Native) applications.
|
|
5
|
+
It supports both Expo native and web apps.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
@@ -20,7 +22,8 @@ pnpm add better-auth @better-auth/expo
|
|
|
20
22
|
bun add better-auth @better-auth/expo
|
|
21
23
|
```
|
|
22
24
|
|
|
23
|
-
You will also need to install `expo-secure-store` for secure session and cookie
|
|
25
|
+
You will also need to install `expo-secure-store` for secure session and cookie
|
|
26
|
+
storage in your Expo app:
|
|
24
27
|
|
|
25
28
|
```bash
|
|
26
29
|
npm install expo-secure-store
|
|
@@ -36,24 +39,26 @@ bun add expo-secure-store
|
|
|
36
39
|
|
|
37
40
|
### Configure the Better Auth Backend
|
|
38
41
|
|
|
39
|
-
Ensure you have a Better Auth backend set up.
|
|
42
|
+
Ensure you have a Better Auth backend set up.
|
|
43
|
+
You can follow the main [Installation Guide][].
|
|
40
44
|
|
|
41
|
-
Then, add the Expo plugin to your Better Auth server configuration (e.g., in
|
|
45
|
+
Then, add the Expo plugin to your Better Auth server configuration (e.g., in
|
|
46
|
+
your `auth.ts` or `lib/auth.ts` file):
|
|
42
47
|
|
|
43
48
|
```typescript
|
|
44
49
|
// lib/auth.ts
|
|
45
|
-
import { betterAuth } from
|
|
46
|
-
import { expo } from
|
|
50
|
+
import { betterAuth } from 'better-auth';
|
|
51
|
+
import { expo } from '@better-auth/expo'; // Import the server plugin
|
|
47
52
|
|
|
48
53
|
export const auth = betterAuth({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
// ...your other Better Auth options
|
|
55
|
+
baseURL: 'http://localhost:8081', // The base URL of your application server where the routes are mounted.
|
|
56
|
+
plugins: [expo()], // Add the Expo server plugin
|
|
57
|
+
emailAndPassword: {
|
|
58
|
+
enabled: true,
|
|
59
|
+
},
|
|
60
|
+
// Add other configurations like trustedOrigins
|
|
61
|
+
trustedOrigins: ['myapp://'], // Replace "myapp" with your app's scheme
|
|
57
62
|
});
|
|
58
63
|
```
|
|
59
64
|
|
|
@@ -63,33 +68,39 @@ In your Expo app, initialize the client (e.g., in `lib/auth-client.ts`):
|
|
|
63
68
|
|
|
64
69
|
```typescript
|
|
65
70
|
// lib/auth-client.ts
|
|
66
|
-
import { createAuthClient } from
|
|
67
|
-
import { expoClient } from
|
|
68
|
-
import * as SecureStore from
|
|
71
|
+
import { createAuthClient } from 'better-auth/react';
|
|
72
|
+
import { expoClient } from '@better-auth/expo/client'; // Import the client plugin
|
|
73
|
+
import * as SecureStore from 'expo-secure-store';
|
|
69
74
|
|
|
70
75
|
export const authClient = createAuthClient({
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
baseURL: 'http://localhost:8081', // Your Better Auth backend URL
|
|
77
|
+
plugins: [
|
|
78
|
+
expoClient({
|
|
79
|
+
scheme: 'myapp', // Your app's scheme (defined in app.json)
|
|
80
|
+
storagePrefix: 'myapp', // A prefix for storage keys
|
|
81
|
+
storage: SecureStore, // Pass SecureStore for token storage
|
|
82
|
+
}),
|
|
83
|
+
],
|
|
79
84
|
});
|
|
80
85
|
|
|
81
86
|
// You can also export specific methods if you prefer:
|
|
82
87
|
// export const { signIn, signUp, useSession } = authClient;
|
|
83
88
|
```
|
|
84
|
-
|
|
89
|
+
|
|
90
|
+
Make sure your app’s scheme (e.g., “myapp”) is defined in your `app.json`.
|
|
85
91
|
|
|
86
92
|
## Documentation
|
|
87
93
|
|
|
88
|
-
For more detailed information and advanced configurations, please refer to the
|
|
94
|
+
For more detailed information and advanced configurations, please refer to the
|
|
95
|
+
documentation:
|
|
89
96
|
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
* **Main Better Auth Installation:** [Installation Guide][]
|
|
98
|
+
* **Expo Integration Guide:** [Expo Integration Guide][]
|
|
92
99
|
|
|
93
100
|
## License
|
|
94
101
|
|
|
95
102
|
MIT
|
|
103
|
+
|
|
104
|
+
[expo integration guide]: https://www.better-auth.com/docs/integrations/expo
|
|
105
|
+
|
|
106
|
+
[installation guide]: https://www.better-auth.com/docs/installation
|
package/dist/index.d.mts
CHANGED
|
@@ -10,6 +10,13 @@ interface ExpoOptions {
|
|
|
10
10
|
*/
|
|
11
11
|
disableOriginOverride?: boolean | undefined;
|
|
12
12
|
}
|
|
13
|
+
declare module "@better-auth/core" {
|
|
14
|
+
interface BetterAuthPluginRegistry<Auth, Context> {
|
|
15
|
+
expo: {
|
|
16
|
+
creator: typeof expo;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
13
20
|
declare const expo: (options?: ExpoOptions | undefined) => {
|
|
14
21
|
id: "expo";
|
|
15
22
|
init: (ctx: better_auth0.AuthContext) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/expo",
|
|
3
|
-
"version": "1.5.0-beta.
|
|
3
|
+
"version": "1.5.0-beta.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Better Auth integration for Expo and React Native applications.",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -61,16 +61,16 @@
|
|
|
61
61
|
"expo-web-browser": "~14.2.0",
|
|
62
62
|
"react-native": "~0.80.2",
|
|
63
63
|
"tsdown": "^0.17.2",
|
|
64
|
-
"@better-auth/core": "1.5.0-beta.
|
|
65
|
-
"better-auth": "1.5.0-beta.
|
|
64
|
+
"@better-auth/core": "1.5.0-beta.3",
|
|
65
|
+
"better-auth": "1.5.0-beta.3"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"expo-constants": ">=17.0.0",
|
|
69
69
|
"expo-linking": ">=7.0.0",
|
|
70
70
|
"expo-network": "^8.0.7",
|
|
71
71
|
"expo-web-browser": ">=14.0.0",
|
|
72
|
-
"better-auth": "1.5.0-beta.
|
|
73
|
-
"
|
|
72
|
+
"@better-auth/core": "1.5.0-beta.3",
|
|
73
|
+
"better-auth": "1.5.0-beta.3"
|
|
74
74
|
},
|
|
75
75
|
"peerDependenciesMeta": {
|
|
76
76
|
"expo-constants": {
|
|
@@ -79,16 +79,13 @@
|
|
|
79
79
|
"expo-linking": {
|
|
80
80
|
"optional": true
|
|
81
81
|
},
|
|
82
|
-
"expo-network": {
|
|
83
|
-
"optional": true
|
|
84
|
-
},
|
|
85
82
|
"expo-web-browser": {
|
|
86
83
|
"optional": true
|
|
87
84
|
}
|
|
88
85
|
},
|
|
89
86
|
"dependencies": {
|
|
90
87
|
"@better-fetch/fetch": "1.1.21",
|
|
91
|
-
"better-call": "1.1.
|
|
88
|
+
"better-call": "1.1.8",
|
|
92
89
|
"zod": "^4.1.12"
|
|
93
90
|
},
|
|
94
91
|
"files": [
|