diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-21 15:51:30 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-21 15:51:30 +0200 |
commit | a24bd1ed41b43790bab6ba789580bb4e85f07d85 (patch) | |
tree | a54b0f6c921ba83a6e909cd0ced325b2d4b8863c /server/tools/peertube-get-access-token.ts | |
parent | 5f26f13b3c16ac5ae0a3b0a7142d84a9528cf565 (diff) | |
parent | c63830f15403ac4e750829f27d8bbbdc9a59282c (diff) | |
download | PeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.tar.gz PeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.tar.zst PeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.zip |
Merge branch 'next' into develop
Diffstat (limited to 'server/tools/peertube-get-access-token.ts')
-rw-r--r-- | server/tools/peertube-get-access-token.ts | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/server/tools/peertube-get-access-token.ts b/server/tools/peertube-get-access-token.ts index 9488eba0e..a67de9180 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 { assignToken, buildServer } from './cli' |
6 | 6 | ||
7 | program | 7 | program |
8 | .option('-u, --url <url>', 'Server url') | 8 | .option('-u, --url <url>', 'Server url') |
@@ -24,24 +24,11 @@ if ( | |||
24 | process.exit(-1) | 24 | process.exit(-1) |
25 | } | 25 | } |
26 | 26 | ||
27 | getClient(options.url) | 27 | const server = buildServer(options.url) |
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 | 28 | ||
41 | return serverLogin(server) | 29 | assignToken(server, options.username, options.password) |
42 | }) | 30 | .then(() => { |
43 | .then(accessToken => { | 31 | console.log(server.accessToken) |
44 | console.log(accessToken) | ||
45 | process.exit(0) | 32 | process.exit(0) |
46 | }) | 33 | }) |
47 | .catch(err => { | 34 | .catch(err => { |