File tree Expand file tree Collapse file tree
packages/backend/src/api/endpoints Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' @clerk/backend ' : minor
3+ ---
4+
5+ Adds the ability to create an active session to the Backend API client.
6+
7+ ``` ts
8+ import { createClerkClient } from ' @clerk/backend' ;
9+
10+ const clerkClient = createClerkClient (... );
11+ await clerkClient .sessions .createSession ({
12+ userId: ' user_xxxxxx' ,
13+ });
14+ ```
Original file line number Diff line number Diff line change @@ -25,6 +25,10 @@ type RefreshTokenParams = {
2525 format ?: 'token' | 'cookie' ;
2626} ;
2727
28+ type CreateSessionParams = {
29+ userId : string ;
30+ } ;
31+
2832export class SessionAPI extends AbstractAPI {
2933 public async getSessionList ( params : SessionListParams = { } ) {
3034 return this . request < PaginatedResourceResponse < Session [ ] > > ( {
@@ -42,6 +46,14 @@ export class SessionAPI extends AbstractAPI {
4246 } ) ;
4347 }
4448
49+ public async createSession ( params : CreateSessionParams ) {
50+ return this . request < Session > ( {
51+ method : 'POST' ,
52+ path : basePath ,
53+ bodyParams : params ,
54+ } ) ;
55+ }
56+
4557 public async revokeSession ( sessionId : string ) {
4658 this . requireId ( sessionId ) ;
4759 return this . request < Session > ( {
You can’t perform that action at this time.
0 commit comments