WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 73f760d

Browse files
committed
Add revokeUserSessions method
1 parent b613c72 commit 73f760d

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@authsignal/node",
3-
"version": "2.7.3",
3+
"version": "2.8.0",
44
"main": "./dist/index.js",
55
"module": "./dist/index.mjs",
66
"types": "dist/index.d.ts",

src/authsignal.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ import {
4141
RefreshSessionRequest,
4242
RefreshSessionResponse,
4343
RevokeSessionRequest,
44+
RevokeUserSessionsRequest,
4445
} from "./types";
4546
import {Webhook} from "./webhook";
4647

4748
export const DEFAULT_API_URL = "https://api.authsignal.com/v1";
4849

49-
const VERSION = "2.7.3";
50+
const VERSION = "2.8.0";
5051

5152
const DEFAULT_RETRIES = 2;
5253
const RETRY_ERROR_CODES = ["ECONNRESET", "EPIPE", "ECONNREFUSED"];
@@ -450,6 +451,18 @@ export class Authsignal {
450451
}
451452
}
452453

454+
public async revokeUserSessions(request: RevokeUserSessionsRequest): Promise<void> {
455+
const url = `${this.apiUrl}/sessions/user/revoke`;
456+
457+
const config = this.getRequestConfig();
458+
459+
try {
460+
await axios.post(url, request, config);
461+
} catch (error) {
462+
throw mapToAuthsignalError(error);
463+
}
464+
}
465+
453466
private getRequestConfig() {
454467
return {
455468
auth: {

src/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,10 @@ export interface RevokeSessionRequest {
265265
accessToken: string;
266266
}
267267

268+
export interface RevokeUserSessionsRequest {
269+
userId: string;
270+
}
271+
268272
export enum UserActionState {
269273
ALLOW = "ALLOW",
270274
BLOCK = "BLOCK",

0 commit comments

Comments
 (0)