-import { HttpStatusCode } from '@shared/core-utils'
+import { HttpStatusCode } from '@shared/models'
import { PeerTubeProblemDocument } from '@shared/models'
import { unwrapBody } from '../requests'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
client?: { id?: string, secret?: string }
user?: { username: string, password?: string }
} = {}) {
- const { client = this.server.client, user = this.server.user } = options
+ const { client = this.server.store.client, user = this.server.store.user } = options
const path = '/api/v1/users/token'
const body = {
...options,
path,
- type: 'form',
+ requestType: 'form',
fields: body,
implicitToken: false,
defaultExpectedStatus: HttpStatusCode.OK_200
async getAccessToken (arg1?: { username: string, password?: string } | string, password?: string) {
let user: { username: string, password?: string }
- if (!arg1) user = this.server.user
+ if (!arg1) user = this.server.store.user
else if (typeof arg1 === 'object') user = arg1
else user = { username: arg1, password }
const path = '/api/v1/users/token'
const body = {
- client_id: this.server.client.id,
- client_secret: this.server.client.secret,
+ client_id: this.server.store.client.id,
+ client_secret: this.server.store.client.secret,
username: username,
response_type: 'code',
grant_type: 'password',
...options,
path,
- type: 'form',
+ requestType: 'form',
fields: body,
implicitToken: false,
defaultExpectedStatus: HttpStatusCode.OK_200
...options,
path,
- type: 'form',
+ requestType: 'form',
implicitToken: false,
defaultExpectedStatus: HttpStatusCode.OK_200
}))
const path = '/api/v1/users/token'
const body = {
- client_id: this.server.client.id,
- client_secret: this.server.client.secret,
+ client_id: this.server.store.client.id,
+ client_secret: this.server.store.client.secret,
refresh_token: options.refreshToken,
response_type: 'code',
grant_type: 'refresh_token'
...options,
path,
- type: 'form',
+ requestType: 'form',
fields: body,
implicitToken: false,
defaultExpectedStatus: HttpStatusCode.OK_200