mirror of
https://github.com/better-auth/better-auth.git
synced 2026-06-03 04:46:19 -05:00
Merge branch 'main' into expo
This commit is contained in:
@@ -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
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
@@ -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
3
examples/expo-example/expo-env.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/// <reference types="expo/types" />
|
||||
|
||||
// NOTE: This file should not be edited and should be in your git ignore
|
||||
@@ -40,7 +40,6 @@ export const useAuthQuery = <T>(
|
||||
isPending: value.get().isPending,
|
||||
})
|
||||
: options;
|
||||
|
||||
return $fetch<T>(path, {
|
||||
...opts,
|
||||
onSuccess: async (context) => {
|
||||
|
||||
@@ -13,7 +13,7 @@ export const multiSessionClient = () => {
|
||||
matcher(path) {
|
||||
return path === "/multi-session/set-active";
|
||||
},
|
||||
signal: "$sessionSignal"
|
||||
signal: "$sessionSignal",
|
||||
},
|
||||
],
|
||||
} satisfies BetterAuthClientPlugin;
|
||||
|
||||
Reference in New Issue
Block a user