is there's any clear example of endpoint API logout who allows to delete the token saved in logging In instead of making logging out with the web browser ?
i guess there's not any documentation about how the LoopBack generates a default user while creating a new project
this is my endpoint Login and it works :
@post('/users/sessions', {
responses: {
'200': {
description: 'Token',
content: {
'application/json': {
schema: {
type: 'object',
properties: {
token: {
type: 'string',
},
},
},
},
},
},
},
})
async login(
@requestBody(CredentialsRequestBody) credentials: Credentials,
) {
// ensure the user exists, and the password is correct
const user = await this.userService.verifyCredentials(credentials);
// convert a User object into a UserProfile object (reduced set of properties)
const userProfile = this.userService.convertToUserProfile(user);
// create a JSON Web Token based on the user profile
const token = await this.jwtService.generateToken(userProfile);
// declare the returned properties based on Model User
const { firstName, lastName, email, id, roles, entreprise, entrepriseId, adress, CIN, phoneNumber } = user;
return {
token,
firstName,
lastName,
email,
id,
roles,
entreprise,
entrepriseId,
adress,
CIN,
phoneNumber
};
}
is there's any HTTP Method of logging out ?