aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-22 16:07:04 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-05-04 16:21:39 +0200
commit7fed637506043e4432cbebe041ada0625171cceb (patch)
tree07f174e17c4b4a0b3d43a0fa6944865c06234338 /shared/extra-utils
parent8d4197637868d5cde49434e937186b57e40f4b2b (diff)
downloadPeerTube-7fed637506043e4432cbebe041ada0625171cceb.tar.gz
PeerTube-7fed637506043e4432cbebe041ada0625171cceb.tar.zst
PeerTube-7fed637506043e4432cbebe041ada0625171cceb.zip
Begin auth plugin support
Diffstat (limited to 'shared/extra-utils')
-rw-r--r--shared/extra-utils/users/login.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/shared/extra-utils/users/login.ts b/shared/extra-utils/users/login.ts
index 4fe54a74a..2d68337a6 100644
--- a/shared/extra-utils/users/login.ts
+++ b/shared/extra-utils/users/login.ts
@@ -27,6 +27,16 @@ function login (url: string, client: Client, user: User, expectedStatus = 200) {
27 .expect(expectedStatus) 27 .expect(expectedStatus)
28} 28}
29 29
30function logout (url: string, token: string, expectedStatus = 200) {
31 const path = '/api/v1/users/revoke-token'
32
33 return request(url)
34 .post(path)
35 .set('Authorization', 'Bearer ' + token)
36 .type('form')
37 .expect(expectedStatus)
38}
39
30async function serverLogin (server: Server) { 40async function serverLogin (server: Server) {
31 const res = await login(server.url, server.client, server.user, 200) 41 const res = await login(server.url, server.client, server.user, 200)
32 42
@@ -71,6 +81,7 @@ function setAccessTokensToServers (servers: ServerInfo[]) {
71 81
72export { 82export {
73 login, 83 login,
84 logout,
74 serverLogin, 85 serverLogin,
75 userLogin, 86 userLogin,
76 getAccessToken, 87 getAccessToken,