@better-auth/expo 1.5.0-beta.1 → 1.5.0-beta.2
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/dist/client.d.mts +21 -0
- package/dist/client.mjs +9 -5
- package/package.json +5 -5
package/dist/client.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FocusManager, OnlineManager } from "better-auth/client";
|
|
2
|
+
import * as expo_web_browser0 from "expo-web-browser";
|
|
2
3
|
import * as _better_fetch_fetch0 from "@better-fetch/fetch";
|
|
3
4
|
import { ClientFetchOption, ClientStore } from "@better-auth/core";
|
|
4
5
|
|
|
@@ -42,6 +43,26 @@ interface ExpoClientOptions {
|
|
|
42
43
|
*/
|
|
43
44
|
cookiePrefix?: string | string[] | undefined;
|
|
44
45
|
disableCache?: boolean | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Options to customize the Expo web browser behavior when opening authentication
|
|
48
|
+
* sessions. These are passed directly to `expo-web-browser`'s
|
|
49
|
+
* `Browser.openBrowserAsync`.
|
|
50
|
+
*
|
|
51
|
+
* For example, on iOS you can use `{ preferEphemeralSession: true }` to prevent
|
|
52
|
+
* the authentication session from sharing cookies with the user's default
|
|
53
|
+
* browser session:
|
|
54
|
+
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* const client = createClient({
|
|
57
|
+
* expo: {
|
|
58
|
+
* webBrowserOptions: {
|
|
59
|
+
* preferEphemeralSession: true,
|
|
60
|
+
* },
|
|
61
|
+
* },
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
webBrowserOptions?: expo_web_browser0.AuthSessionOpenOptions;
|
|
45
66
|
}
|
|
46
67
|
declare function getSetCookie(header: string, prevCookie?: string | undefined): string;
|
|
47
68
|
declare function getCookie(cookie: string): string;
|
package/dist/client.mjs
CHANGED
|
@@ -75,14 +75,18 @@ function parseSetCookieHeader(header) {
|
|
|
75
75
|
const cookieMap = /* @__PURE__ */ new Map();
|
|
76
76
|
splitSetCookieHeader(header).forEach((cookie) => {
|
|
77
77
|
const [nameValue, ...attributes] = cookie.split(";").map((p) => p.trim());
|
|
78
|
-
const [name, ...valueParts] = nameValue.split("=");
|
|
79
|
-
const
|
|
78
|
+
const [name, ...valueParts] = (nameValue || "").split("=");
|
|
79
|
+
const value = valueParts.join("=");
|
|
80
|
+
if (!name || value === void 0) return;
|
|
81
|
+
const attrObj = { value };
|
|
80
82
|
attributes.forEach((attr) => {
|
|
81
83
|
const [attrName, ...attrValueParts] = attr.split("=");
|
|
84
|
+
if (!attrName?.trim()) return;
|
|
82
85
|
const attrValue = attrValueParts.join("=");
|
|
83
|
-
|
|
86
|
+
const normalizedAttrName = attrName.trim().toLowerCase();
|
|
87
|
+
attrObj[normalizedAttrName] = attrValue;
|
|
84
88
|
});
|
|
85
|
-
cookieMap.set(name,
|
|
89
|
+
cookieMap.set(name, attrObj);
|
|
86
90
|
});
|
|
87
91
|
return cookieMap;
|
|
88
92
|
}
|
|
@@ -275,7 +279,7 @@ const expoClient = (opts) => {
|
|
|
275
279
|
Browser.dismissAuthSession();
|
|
276
280
|
} catch {}
|
|
277
281
|
const proxyURL = `${context.request.baseURL}/expo-authorization-proxy?authorizationURL=${encodeURIComponent(signInURL)}`;
|
|
278
|
-
const result = await Browser.openAuthSessionAsync(proxyURL, to);
|
|
282
|
+
const result = await Browser.openAuthSessionAsync(proxyURL, to, opts?.webBrowserOptions);
|
|
279
283
|
if (result.type !== "success") return;
|
|
280
284
|
const url = new URL(result.url);
|
|
281
285
|
const cookie = String(url.searchParams.get("cookie"));
|
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.2",
|
|
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.2",
|
|
65
|
+
"better-auth": "1.5.0-beta.2"
|
|
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
|
-
"@better-auth/core": "1.5.0-beta.
|
|
72
|
+
"better-auth": "1.5.0-beta.2",
|
|
73
|
+
"@better-auth/core": "1.5.0-beta.2"
|
|
74
74
|
},
|
|
75
75
|
"peerDependenciesMeta": {
|
|
76
76
|
"expo-constants": {
|