In LoopBack 4
framework, for any secured API call, I need to authenticate the request for every endpoint. Instead of this approach i wants to configure that verification globally like LoopBack 3
. Any solution for this?
@post('/users/{userId}/orders', {
responses: {
'200': {
description: 'User.Order model instance',
content: {'application/json': {schema: {'x-ts-type': Order}}},
},
},
})
@authenticate('jwt')
@authorize({resource: 'order', scopes: ['create']})
async createOrder(
@param.path.string('userId') userId: string,
@requestBody() order: Order,
): Promise<Order> {
await this.userRepo.orders(userId).create(order);
}
In above code @authenticate('jwt')
was mentioned, can we mention this in a common file?