aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools/get-access-token.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2018-07-25 22:01:25 +0200
committerRigel Kent <sendmemail@rigelk.eu>2018-07-25 22:01:25 +0200
commitc1e791bad0b079af67398f6407221e6dcbb573dd (patch)
tree82e5944b4458dd35aa482a38f6b650eb93bb89ad /server/tools/get-access-token.ts
parent5f7021c33d31c5255b995ae0ff86b5bbea4ea4b9 (diff)
downloadPeerTube-c1e791bad0b079af67398f6407221e6dcbb573dd.tar.gz
PeerTube-c1e791bad0b079af67398f6407221e6dcbb573dd.tar.zst
PeerTube-c1e791bad0b079af67398f6407221e6dcbb573dd.zip
expliciting type checks and predicates (server only)
Diffstat (limited to 'server/tools/get-access-token.ts')
-rw-r--r--server/tools/get-access-token.ts30
1 files changed, 15 insertions, 15 deletions
diff --git a/server/tools/get-access-token.ts b/server/tools/get-access-token.ts
index 66fa70814..d86c84c8d 100644
--- a/server/tools/get-access-token.ts
+++ b/server/tools/get-access-token.ts
@@ -2,7 +2,10 @@ import * as program from 'commander'
2 2
3import { 3import {
4 getClient, 4 getClient,
5 serverLogin 5 serverLogin,
6 Server,
7 Client,
8 User
6} from '../tests/utils/index' 9} from '../tests/utils/index'
7 10
8program 11program
@@ -19,22 +22,19 @@ if (
19 throw new Error('All arguments are required.') 22 throw new Error('All arguments are required.')
20} 23}
21 24
22const server = {
23 url: program['url'],
24 user: {
25 username: program['username'],
26 password: program['password']
27 },
28 client: {
29 id: null,
30 secret: null
31 }
32}
33
34getClient(program.url) 25getClient(program.url)
35 .then(res => { 26 .then(res => {
36 server.client.id = res.body.client_id 27 const server = {
37 server.client.secret = res.body.client_secret 28 url: program['url'],
29 user: {
30 username: program['username'],
31 password: program['password']
32 } as User,
33 client: {
34 id: res.body.client_id as string,
35 secret: res.body.client_secret as string
36 } as Client
37 } as Server
38 38
39 return serverLogin(server) 39 return serverLogin(server)
40 }) 40 })