X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=server%2Ftools%2Fpeertube-get-access-token.ts;h=a67de9180d3b9b1257adc2adef47dc0b728989f4;hb=21d68e68039a1eefbe6213fbde46e737e520ee7d;hp=b2c278c4876eb4dabd90ac03a7d8cd41de5448c4;hpb=ba5a8d89bbf049e4afc41543bcc072cccdb02669;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tools/peertube-get-access-token.ts b/server/tools/peertube-get-access-token.ts index b2c278c48..a67de9180 100644 --- a/server/tools/peertube-get-access-token.ts +++ b/server/tools/peertube-get-access-token.ts @@ -1,8 +1,8 @@ import { registerTSPaths } from '../helpers/register-ts-paths' registerTSPaths() -import * as program from 'commander' -import { getClient, Server, serverLogin } from '../../shared/extra-utils' +import { program } from 'commander' +import { assignToken, buildServer } from './cli' program .option('-u, --url ', 'Server url') @@ -24,24 +24,11 @@ if ( process.exit(-1) } -getClient(options.url) - .then(res => { - const server = { - url: options.url, - user: { - username: options.username, - password: options.password - }, - client: { - id: res.body.client_id, - secret: res.body.client_secret - } - } as Server +const server = buildServer(options.url) - return serverLogin(server) - }) - .then(accessToken => { - console.log(accessToken) +assignToken(server, options.username, options.password) + .then(() => { + console.log(server.accessToken) process.exit(0) }) .catch(err => {