Add auth and blacklist APIs
This commit is contained in:
24
server/actions/createAuth.js
Normal file
24
server/actions/createAuth.js
Normal file
@ -0,0 +1,24 @@
|
||||
const AuthAPI = require('../AuthAPI')
|
||||
|
||||
const DefaultScopes = {
|
||||
blacklist: {
|
||||
read: true
|
||||
}
|
||||
}
|
||||
|
||||
function createAuth(req, res) {
|
||||
AuthAPI.createToken(DefaultScopes).then(
|
||||
token => {
|
||||
res.send({ token })
|
||||
},
|
||||
error => {
|
||||
console.error(error)
|
||||
|
||||
res.status(500).send({
|
||||
error: 'Unable to generate auth token'
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
module.exports = createAuth
|
Reference in New Issue
Block a user