]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tools/peertube-get-access-token.ts
Adapt CLI to new commands
[github/Chocobozzz/PeerTube.git] / server / tools / peertube-get-access-token.ts
index 5868d05485b0a27abbd6ae82e4991bf74f8bee4d..a67de9180d3b9b1257adc2adef47dc0b728989f4 100644 (file)
@@ -2,7 +2,7 @@ import { registerTSPaths } from '../helpers/register-ts-paths'
 registerTSPaths()
 
 import { program } from 'commander'
-import { getAccessToken } from '../../shared/extra-utils'
+import { assignToken, buildServer } from './cli'
 
 program
   .option('-u, --url <url>', 'Server url')
@@ -24,9 +24,11 @@ if (
   process.exit(-1)
 }
 
-getAccessToken(options.url, options.username, options.password)
-  .then(accessToken => {
-    console.log(accessToken)
+const server = buildServer(options.url)
+
+assignToken(server, options.username, options.password)
+  .then(() => {
+    console.log(server.accessToken)
     process.exit(0)
   })
   .catch(err => {