diff options
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) |