You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/docs/plugins/anonymous.mdx
+27-2Lines changed: 27 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,7 +76,8 @@ const user = await authClient.signIn.anonymous()
76
76
77
77
### Link Account
78
78
79
-
If a user is already signed in anonymously and tries to `signIn` or `signUp` with another method, their anonymous activities can be linked to the new account.
79
+
If a user is already signed in anonymously and tries to `signIn` or `signUp` with another method,
80
+
their anonymous activities can be linked to the new account.
80
81
81
82
To do that you first need to provide `onLinkAccount` callback to the plugin.
82
83
@@ -101,6 +102,27 @@ const user = await authClient.signIn.email({
101
102
})
102
103
```
103
104
105
+
### Delete Anonymous User
106
+
107
+
To delete an anonymous user, you can call the `/delete-anonymous-user` endpoint.
108
+
109
+
<APIMethod
110
+
path="/delete-anonymous-user"
111
+
method="POST"
112
+
noResult
113
+
>
114
+
```ts
115
+
typedeleteAnonymousUser= {
116
+
}
117
+
```
118
+
</APIMethod>
119
+
120
+
<Callout type="info">
121
+
**Notes:**
122
+
- The anonymous user is deleted by default when the account is linked to a new authentication method.
123
+
- Setting `disableDeleteAnonymousUser` to `true` will prevent the anonymous user from being able to call the `/delete-anonymous-user` endpoint.
124
+
</Callout>
125
+
104
126
## Options
105
127
106
128
### `emailDomainName`
@@ -151,7 +173,10 @@ A callback function that is called when an anonymous user links their account to
151
173
152
174
### `disableDeleteAnonymousUser`
153
175
154
-
By default, the anonymous user is deleted when the account is linked to a new authentication method. Set this option to `true` to disable this behavior.
176
+
By default, when an anonymous user links their account to a new authentication method,
177
+
the anonymous user record is automatically deleted.
178
+
If you set this option to `true`, this automatic deletion will be disabled,
179
+
and the `/delete-anonymous-user` endpoint will no longer be accessible to anonymous users.
0 commit comments