Merge branch 'main' into expo

This commit is contained in:
Bereket Engida
2024-10-31 23:50:41 +03:00
committed by GitHub
6 changed files with 24 additions and 13 deletions

View File

@@ -101,6 +101,9 @@ app.get("/session", async (c) => {
if(!user) return c.body(null, 401);
return c.json(session, user);
return c.json({
session,
user
});
});
```

View File

@@ -185,7 +185,9 @@ For security reasons, it's recommended to keep the private key encrypted.
```ts title="auth.ts"
jwt({
disablePrivateKeyEncryption: true
jwks: {
disablePrivateKeyEncryption: true
}
})
```
@@ -195,11 +197,13 @@ By default the entire user object is added to the JWT payload. You can modify th
```ts title="auth.ts"
jwt({
definePayload: (user) => {
return {
id: user.id,
email: user.email,
role: user.role
jwt: {
definePayload: (user) => {
return {
id: user.id,
email: user.email,
role: user.role
}
}
}
})
@@ -210,8 +214,10 @@ If none is given, the BASE_URL is used as the issuer and the audience is set to
```ts title="auth.ts"
jwt({
issuer: "https://example.com",
audience: "https://example.com",
expiresIn: "1h"
jwt: {
issuer: "https://example.com",
audience: "https://example.com",
expirationTime: "1h"
}
})
```

View File

@@ -235,7 +235,7 @@ const auth = betterAuth({
}}
/>
### `trustedOrignins`
### `trustedOrigins`
list of trusted origins. This is very important to prevent CSRF attacks and open redirects.

3
examples/expo-example/expo-env.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
/// <reference types="expo/types" />
// NOTE: This file should not be edited and should be in your git ignore

View File

@@ -40,7 +40,6 @@ export const useAuthQuery = <T>(
isPending: value.get().isPending,
})
: options;
return $fetch<T>(path, {
...opts,
onSuccess: async (context) => {

View File

@@ -13,7 +13,7 @@ export const multiSessionClient = () => {
matcher(path) {
return path === "/multi-session/set-active";
},
signal: "$sessionSignal"
signal: "$sessionSignal",
},
],
} satisfies BetterAuthClientPlugin;