Open nicolaipre opened 3 years ago
I found the problem.
Some parts of the code did not have self.app.make("Request")
instead of self.request
.
This seems to be present in the following files:
masonite/api/resources/Resource.py: auth = self.request.app().make(Auth)
masonite/api/resources/Resource.py: response = self.request.app().resolve(getattr(self, 'create'))
masonite/api/resources/Resource.py: response = self.request.app().resolve(getattr(self, 'show'))
masonite/api/resources/Resource.py: response = self.request.app().resolve(getattr(self, 'index'))
masonite/api/resources/Resource.py: response = self.request.app().resolve(getattr(self, 'update'))
masonite/api/resources/Resource.py: response = self.request.app().resolve(getattr(self, 'delete'))
masonite/api/resources/Resource.py: self.request.status(404)
masonite/api/resources/Resource.py: record = self.model.create(self.request.all())
masonite/api/authentication/BaseAuthentication.py: return self.request.app().resolve(self.authenticate)
masonite/api/guards/APIJwtDriver.py: self.request.cookie('token', token)
masonite/api/guards/APIJwtDriver.py: self.request.delete_cookie('token')
masonite/api/guards/APIJwtDriver.py: self.request.reset_user()
masonite/api/guards/APIGuard.py: self.request.set_user(model)
I also noticed that AuthCookieDriver
in masonite framework has been updated, while AuthJwtDriver
has not.
See
masonite/drivers/authentication/AuthJwtDriver.py
What is the current status on APIs in Masonite? Is the current https://github.com/masoniteframework/api/tree/3.0 successfully up to date and useable with versions of Masonite 3?
I am currently using
masonite-api==3.0.0
, which I assume is compatible with Masonite 3.0.When changing
AUTH_GUARD
to api in.env
, and having importedApiProvider
inconfig/providers.py
under# Third Party Providers
(as stated in the docs for 2.3) I run into the following issue:I noticed this happens because the
AuthenticationProvider
(which is imported earlier thanApiProvider
) attempts to set the default guard before it is actually registered. I tried to bypass this problem by movingAuthenticationProvider
belowApiProvider
to force register it before it is being set byAuthentcationProvider
, which results in the following error:I suspect the last error is due to changes in the Request handler as stated in the documented changes in 3.0: https://docs.masoniteproject.com/upgrade-guide/masonite-2.3-to-3.0#request-init-offset
Are there any plans to further update this repository, or will everything be reworked in Masonite 4?