Skip to content
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

[BUG] Route method is not overriding #110

Closed
Giovanny-DS opened this issue Aug 5, 2022 · 4 comments
Closed

[BUG] Route method is not overriding #110

Giovanny-DS opened this issue Aug 5, 2022 · 4 comments
Labels
question Further information is requested

Comments

@Giovanny-DS
Copy link

Describe the bug
The route method is not overriding, or I'm doing it wrong but can't find anything besides the marketplace example.

To Reproduce
Steps to reproduce the behavior:

  1. You can go and install https://github.com/Giovanny-DS/sharedbackend
  2. Run it, and check that admin/auth is not overriding the handler.
  3. You may also just go and check the auth module code that I did write.

Expected behavior
we should receive a JSON like
{ user: cleanRes, test: 'test' }

instead of just
{ user: cleanRes }

Screenshots
not applicable?

Package version:

  • Version 1.7.2

Additional context
I think all it's clear, but I can answer any question fast.

@adrien2p
Copy link
Owner

adrien2p commented Aug 5, 2022

Hi there, could you set the requireAuth to false and add the authenticate middleware from medusa before your handler.

Those routes are not meant to be overridden originally but you can achieve that the way i gave you above. In the future, it is likely that those routes will call an auth strategy instead of being implemented. Which means that when it will happen, you will likely have to update the strategy to return what you want. But at the moment, this is the way to do it 💪

Let me know ☺️

@Giovanny-DS
Copy link
Author

Giovanny-DS commented Aug 5, 2022

Thanks, I'll try it out. and give feedback.
I assume it would works since the docs say we can add and override routes.

Do you have an example of how the auth middleware should be?

@adrien2p
Copy link
Owner

adrien2p commented Aug 5, 2022

You can just use the one provided by medusa (authenticate).

Yes you can still override it

@Giovanny-DS
Copy link
Author

Just got it working!!. thanks!!

@adrien2p adrien2p added the question Further information is requested label Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants