- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unauthorized Accession to Product Route #45
Comments
Hi @Sr52-tech , if you're getting Can you double check and make sure that you're passing the correct token in the header? And if that doesn't work, please share the content of |
yes did not work here is the import {
defineMiddlewares,
authenticate,
validateAndTransformBody,
} from "@medusajs/framework/http"
import { PostVendorCreateSchema } from "./vendors/route"
export default defineMiddlewares({
routes: [
{
matcher: "/vendors",
method: ["POST"],
middlewares: [
authenticate("vendor", ["session", "bearer"], {
allowUnregistered: true,
}),
validateAndTransformBody(PostVendorCreateSchema),
],
},
{
matcher: "/vendors/*",
middlewares: [
authenticate("vendor", ["session", "bearer"]),
],
},
],
}) |
You didn't add the middleware mentioned here. Adding it will fix your issue. |
worked! thank you so much |
Hello there, I'm following the marketplace recipe and made it until step 6 -> creating product route, have followed the exact steps yet, when I test it I get
{"message":"Unauthorized"}
I started with the authentication first I registered a vendor:
received a token and I have put it here:
then I loged in:
after logging in I recived a token I took it and putted it here:
and finally, got this message
{"message":"Unauthorized"}
according to chatGPT the problem is in product route
node: v22.14.0
docs: https://docs.medusajs.com/resources/recipes/marketplace/examples/vendors#test-it-out-1
OS: MacOS
Medusa: 2.6.1
The text was updated successfully, but these errors were encountered: