You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
507 B

'use strict';
const createAuthenticatedUser = async ({ strapi, userInfo }) => {
const defaultRole = await strapi.db
.query('plugin::users-permissions.role')
.findOne({ where: { type: 'authenticated' } });
const user = await strapi.service('plugin::users-permissions.user').add({
role: defaultRole.id,
...userInfo,
});
const jwt = strapi.service('plugin::users-permissions.jwt').issue({ id: user.id });
return { user, jwt };
};
module.exports = {
createAuthenticatedUser,
};