diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-09 15:03:44 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | 078f17e6d90376050f43ce639e88e11869b49ee7 (patch) | |
tree | 1aeef2c43591de2f72b84b85672de8e83815e8fa /server/tools/peertube-get-access-token.ts | |
parent | 12edc1495a36b2199f1bf1ba37f50c7b694be382 (diff) | |
download | PeerTube-078f17e6d90376050f43ce639e88e11869b49ee7.tar.gz PeerTube-078f17e6d90376050f43ce639e88e11869b49ee7.tar.zst PeerTube-078f17e6d90376050f43ce639e88e11869b49ee7.zip |
Fix CLI tools
Diffstat (limited to 'server/tools/peertube-get-access-token.ts')
-rw-r--r-- | server/tools/peertube-get-access-token.ts | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/server/tools/peertube-get-access-token.ts b/server/tools/peertube-get-access-token.ts index 9488eba0e..5868d0548 100644 --- a/server/tools/peertube-get-access-token.ts +++ b/server/tools/peertube-get-access-token.ts | |||
@@ -2,7 +2,7 @@ import { registerTSPaths } from '../helpers/register-ts-paths' | |||
2 | registerTSPaths() | 2 | registerTSPaths() |
3 | 3 | ||
4 | import { program } from 'commander' | 4 | import { program } from 'commander' |
5 | import { getClient, Server, serverLogin } from '../../shared/extra-utils' | 5 | import { getAccessToken } from '../../shared/extra-utils' |
6 | 6 | ||
7 | program | 7 | program |
8 | .option('-u, --url <url>', 'Server url') | 8 | .option('-u, --url <url>', 'Server url') |
@@ -24,22 +24,7 @@ if ( | |||
24 | process.exit(-1) | 24 | process.exit(-1) |
25 | } | 25 | } |
26 | 26 | ||
27 | getClient(options.url) | 27 | getAccessToken(options.url, options.username, options.password) |
28 | .then(res => { | ||
29 | const server = { | ||
30 | url: options.url, | ||
31 | user: { | ||
32 | username: options.username, | ||
33 | password: options.password | ||
34 | }, | ||
35 | client: { | ||
36 | id: res.body.client_id, | ||
37 | secret: res.body.client_secret | ||
38 | } | ||
39 | } as Server | ||
40 | |||
41 | return serverLogin(server) | ||
42 | }) | ||
43 | .then(accessToken => { | 28 | .then(accessToken => { |
44 | console.log(accessToken) | 29 | console.log(accessToken) |
45 | process.exit(0) | 30 | process.exit(0) |