mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-11 04:19:31 +00:00
fix: remove callback url from endpoints that doesn't necessarily need it (#362)
This commit is contained in:
@@ -41,7 +41,6 @@ To signup a user, you can use the `signUp.email` function provided by the client
|
||||
- `password`: The password of the user. It should be at least 8 characters long and max 32 by default.
|
||||
- `name`: The name of the user.
|
||||
- `image`: The image of the user. (optional)
|
||||
- `callbackURL`: The url to redirect to after the user has signed up. (optional)
|
||||
|
||||
```ts title="client.ts"
|
||||
const { data, error } = await authClient.signUp.email({
|
||||
@@ -49,7 +48,6 @@ const { data, error } = await authClient.signUp.email({
|
||||
password: "password1234",
|
||||
name: "test",
|
||||
image: "https://example.com/image.png",
|
||||
callbackURL: "/",
|
||||
});
|
||||
```
|
||||
|
||||
@@ -59,14 +57,13 @@ To signin a user, you can use the `signIn.email` function provided by the client
|
||||
|
||||
- `email`: The email address of the user.
|
||||
- `password`: The password of the user.
|
||||
- `callbackURL`: The url to redirect to after the user has signed in. (optional)
|
||||
- `dontRememberMe`: If true, the user will be signed out when the browser is closed. (optional)
|
||||
- `callbackURL`: The URL to redirect to after the user signs in. (optional)
|
||||
|
||||
```ts title="client.ts"
|
||||
const { data, error } = await authClient.signIn.email({
|
||||
email: "test@example.com",
|
||||
password: "password1234",
|
||||
callbackURL: "/",
|
||||
});
|
||||
```
|
||||
|
||||
@@ -78,6 +75,18 @@ To signout a user, you can use the `signOut` function provided by the client.
|
||||
await client.signOut();
|
||||
```
|
||||
|
||||
you can pass `fetchOptions` to redirect onSuccess
|
||||
|
||||
```ts title="client.ts"
|
||||
await client.signOut({
|
||||
fetchOptions: {
|
||||
onSuccess: () => {
|
||||
router.push("/login"); // redirect to login page
|
||||
},
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
### Email Verification
|
||||
|
||||
To enable email verification, you need to pass a function that sends a verification email with a link. The `sendVerificationEmail` function takes an object with the following properties:
|
||||
|
||||
Reference in New Issue
Block a user