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
{{ message }}
Repository navigation
Commit 7443113
Browse filesBrowse the repository at this point in the historyBrowse files
Add `sessions.updateSession()` to change when a single session expires, and `users.mergeUser()` to merge one user into another. The `user.merged` webhook event is now part of `UserWebhookEvent`, with a payload typed as `UserMergedJSON`.
Copy file name to clipboardExpand all lines: packages/backend/src/api/endpoints/SessionApi.ts
+23Lines changed: 23 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,12 @@ export type CreateSessionParams = {
43
43
userId: string;
44
44
};
45
45
46
+
/** @generateWithEmptyComment */
47
+
exporttypeUpdateSessionParams={
48
+
/** When the session should expire. Must be at least 5 minutes and at most 10 years from now. */
49
+
expireAt: Date;
50
+
};
51
+
46
52
/** @generateWithEmptyComment */
47
53
exportclassSessionAPIextendsAbstractAPI{
48
54
/**
@@ -81,6 +87,23 @@ export class SessionAPI extends AbstractAPI {
81
87
});
82
88
}
83
89
90
+
/**
91
+
* Changes when the given session expires. The new expiry applies to this session only and can exceed the instance's session lifetime. Only active and pending sessions can be updated.
92
+
*
93
+
* Take the session ID from the `sid` claim of a verified session token, never from an unverified client request.
94
+
* @param sessionId - The ID of the session to update.
95
+
* @param params - The parameters to update the session with.
96
+
* @returns The updated [`Session`](https://clerk.com/docs/reference/backend/types/backend-session).
* Merges the `fromUserId` user into the given user: moves its identifications, connected accounts, second factors, organization memberships, and metadata onto the given user, then deletes the `fromUserId` user. Where both users have a value, the given user keeps its own.
953
+
*
954
+
* A merge cannot be undone. Use `dryRun` to preview one.
955
+
* @param userId - The ID of the user that remains after the merge.
956
+
* @param params - The parameters for the merge.
957
+
* @returns The remaining [`User`](https://clerk.com/docs/reference/backend/types/backend-user) after the merge, and the deleted user as it was before the merge.
0 commit comments