Strapi = v4
node= v16
I am using my own login system, which create users in my own db but not in Strapi. How can i authorize my user to access API from Strapi.
I am able to verify jwt token using custom middleware but Strapi’s default authorization system is blocking to access API.
Is it possible to disable strapi::security?
How do i do it?
You want to make a custom auth system like u&p still this is not properly documented
'use strict';
const fs = require('fs');
const path = require('path');
const authStrategy = require('./strategies/users-permissions');
const sanitizers = require('./utils/sanitize/sanitizers');
module.exports = ({ strapi }) => {
strapi.container.get('auth').register('content-api', authStrategy);
strapi.sanitizers.add('content-api.output', sanitizers.defaultSanitizeOutput);
if (strapi.plugin('graphql')) {
require('./graphql')({ strapi });
}
if (strapi.plugin('documentation')) {
const specPath = path.join(__dirname, '../documentation/content-api.yaml');
const spec = fs.readFileSync(specPath, 'utf8');
'use strict';
const { castArray, map, every, pipe } = require('lodash/fp');
const { ForbiddenError, UnauthorizedError } = require('@strapi/utils').errors;
const { getService } = require('../utils');
const getAdvancedSettings = () => {
return strapi.store({ type: 'plugin', name: 'users-permissions' }).get({ key: 'advanced' });
};
const authenticate = async (ctx) => {
try {
const token = await getService('jwt').getToken(ctx);
if (token) {
const { id } = token;
// Invalid token
if (id === undefined) {
This file has been truncated. show original