Added logic to loginWithCredentials

This commit is contained in:
RemixDev 2021-05-23 21:21:24 +02:00
parent 49f4804767
commit 47559071d6
2 changed files with 12 additions and 1 deletions

View File

@ -15,6 +15,9 @@ export const configFolder: string = deemix.utils.localpaths.getConfigFolder()
export let settings: any = deemix.settings.load(configFolder)
export const sessionDZ: any = {}
export const getAccessToken = deemix.utils.deezer.getAccessToken
export const getArlFromAccessToken = deemix.utils.deezer.getArlFromAccessToken
const deemixPlugins = {}
export const listener = {

View File

@ -1,12 +1,20 @@
import { ApiHandler } from '../../../types'
import { getAccessToken, getArlFromAccessToken } from '../../../main'
const path = '/loginWithCredentials'
const handler: ApiHandler['handler'] = (req, res) => {
const { username, password } = req.body
let accessToken = req.body.accessToken
if (!accessToken){
const accessToken = getAccessToken(username, password)
console.log({ accessToken })
}
const arl = getArlFromAccessToken(accessToken)
console.log({ username, password })
res.send({ loggedIn: true })
res.send({ accessToken, arl })
}
const apiHandler = { path, handler }