#Unknown authentication strategy "admin-jwt"
1 messages · Page 1 of 1 (latest)
Could you share your plugin package.json and the medusa packages version your are using
The error looks like a miss match version
{
"name": "medusa-source-tagplus",
"version": "0.0.1",
"description": "Source plugin that allows users to import products from a TagPlus Store",
"author": "Murilo Alves <[email protected]>",
"license": "MIT",
"keywords": [
"medusa-plugin",
"medusa-plugin-source"
],
"scripts": {
"prepare": "cross-env NODE_ENV=production yarn run build",
"test": "jest --passWithNoTests src",
"build": "babel --extensions .ts src --out-dir ./dist --ignore '**/__tests__','**/__mocks__'",
"watch": "babel --extensions .ts -w src --out-dir ./dist --ignore '**/__tests__','**/__mocks__'"
},
"peerDependencies": {
"@medusajs/medusa": "^1.6.0",
"axios": "^1.1.2",
"express": "^4.18.2",
"medusa-core-utils": "^1.1.33",
"medusa-interfaces": "^1.3.0",
"typeorm": "^0.3.16"
},
"devDependencies": {
"@babel/cli": "^7.14.3",
"@babel/core": "^7.14.3",
"@babel/preset-typescript": "^7.21.5",
"babel-preset-medusa-package": "^1.1.19",
"cross-env": "^7.0.3"
},
"dependencies": {
"@medusajs/medusa": "^1.6.0",
"cors": "^2.8.5"
}
}
this is a dependencies of medusa backend
"dependencies": {
"@babel/preset-typescript": "^7.21.4",
"@medusajs/admin": "^4.0.1",
"@medusajs/cache-inmemory": "^1.8.4",
"@medusajs/cache-redis": "^1.8.4",
"@medusajs/event-bus-local": "^1.9.1",
"@medusajs/event-bus-redis": "^1.8.4",
"@medusajs/medusa": "^1.10.0",
"@medusajs/medusa-cli": "^1.3.12",
"babel-preset-medusa-package": "^1.1.13",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.2",
"medusa-fulfillment-manual": "^1.1.37",
"medusa-interfaces": "^1.3.7",
"medusa-payment-manual": "^1.0.23",
"medusa-payment-stripe": "^4.0.0",
"typeorm": "npm:@medusajs/typeorm@next"
},
Your peer dependency of medusa in your plugin is 1.6.0 while your backend is 1.10.0, your peer dependency on medusa is also in your dependency instead of being in devDependencies, therefore you are not using the same passport package under the hood hence why you have this issue. I suggest you to cleanup your dependencies a bit 😅
I have been running into this same exact issue lately. It doesn't seem to work no matter what I do if I try it in a plugin OR directly in a route in the medusa backend folder.
Now i give a error to parse my plugin on medusa start server
I think that will be because of the duplication of the the @static krakenjs/medusa packages. You can delete the package in the plugin folder (rm -rf node_modules/@static krakenjs/medusa) and then link the package to the plugin. Go to your medusa backend folder/node_modules/@static krakenja/medusa and type yarn link. Then go back to your plugin root folder and do yarn link @medusajs/medusa. Now it should not give that error because both the plugin and the backend are pointing to the exact same place for that package.
But still, I am having issues with authenticate. I have tried many things, and can't figure out what thing it is that is not working. To simplify, instead of doing it in a plugin, I tried it in a route in my backend/api/index.ts:
import cors from "cors"
import configLoader from "@medusajs/medusa/dist/loaders/config"
import { Router } from "express"
import { registerLoggedInUser } from "./middlewares/logged-in-user"
import { authenticateCustomer } from "@medusajs/medusa"
//import authenticate from "@medusajs/medusa/dist/api/middlewares/authenticate-customer"
export default (rootDirectory: string): Router | Router[] => {
const config = configLoader(rootDirectory)
const storeCorsOptions = { origin: config.projectConfig.store_cors.split(","), credentials: true, }
const adminCorsOptions = { origin: config.projectConfig.admin_cors.split(","), credentials: true, }
const router = Router()
router.use(authenticateCustomer())
router.get("/store/test", cors(storeCorsOptions), async (req, res) => {
return res.json({user: req.user})
})
I've tried different ways of importing to see if that was it. In all cases, req.user is always empty, even if a valid cookie is set. I can even console.log the req and see the session info, just not the user info.
@lean wren you know about this error?
{"level":"warn","message":"/Users/murilo.alves/development/personal/beway/medusa-source-tagplus-2/dist/strategies/import.js did not export a class that implements a strategy interface. Your Medusa server will still work, but if you have written custom strategy logic it will not be used. Make sure to implement the proper interface.","timestamp":"2023-05-17 17:50:26"}
My error with unknown authentication continue after update libraries and I have too error about register my batch job strategy.