🎁 Promise-based Javascript wrapper for Bukalapak API
const {authentication} = require('bukalapak-api')
const USER = {
username: 'hello@me.com',
password: 'hunter2'
}
async function logToken (user) {
try {
const { status, token, confirmed } = await authentication.getApiToken(user)
console.log(token)
} catch (error) {
const {message} = error
console.log(message)
}
}
logToken(USER)
getApiToken({ username: String, password: String })
{
"status" : "OK",
"user_id" : "157324",
"user_name" : "Sayur Kangkung",
"confirmed" : true,
"token" : "U8Ch2LigkVhdI3XwYRA",
"email" : "sayur@kangkung.com",
"omnikey" : "a15d3e8835c69f1c4fd6b38fe9098b4b",
"message" : null
}
{
"status" : "ERROR",
"user_id" : null,
"user_name" : null,
"confirmed" : false,
"token" : null,
"email" : null,
"omnikey" : null,
"message" : "Username atau password tidak valid"
}
facebookLogin({ facebookId: String, facebookToken: String })
{
"status": "OK",
"user_id": "157324",
"user_name": "Sayur Kangkung",
"token": "U8Ch2LigkVhdI3XwYRA",
"message": null
}
{
"status": "ERROR",
"message": "User tidak ditemukan"
}
googleLogin({ email: String, googleToken: String })
{
"status": "OK",
"user_id": "157324",
"user_name": "Sayur Kangkung",
"token": "U8Ch2LigkVhdI3XwYRA",
"message": null
}
{
"status": "ERROR",
"message": "User tidak ditemukan"
}
(WIP)
(WIP)
(WIP)
(WIP)
(WIP)
(WIP)
(WIP)
(WIP)
(WIP)
(WIP)
(WIP)
(WIP)
(WIP)
(WIP)
(WIP)
(WIP)
(WIP)
(WIP)
(WIP)
(WIP)
(WIP)
(WIP)### User Addresses
Looking for contributors! Feel free to open issues and create PR's. Lint your code using prettier
.
MIT. See LICENSE.