Closed grohjy closed 2 years ago
Thanks for reporting. I will check it out :-)
@grohjy I fixed this in v.5.0.0
please note that this is a breaking change and you will need register an additional middleware (see readme for details).
Let me know if you run into any issues and thanks again for reporting this problem.
Hey @eidellev, I hope you won't mind me using this issue to hear my voice, but it seems that Inertia still have a bad time with the Auth module...
It is the same issue, using auth.attempt
raise an error into the browser's console.
Here's all the code that should be relevant to the issue:
{{ messages }}
When making the request, the client does send the X-Inertia
header, and the answer too, however we still receive a non valid Inertia response:
As you can tell, yes, I'm using the middleware as required. And before you ask me, if I use correct credentials, the request will be just fine, and we'll connect smoothly!
Is there anything wrong I'm doing here? I think not... Hope to hear back from you soon 😄
Thank you @Predeactor for reporting this issue. I don't mind at all and I am grateful when other developers are using this thing I am building in my spare time. I will try to reproduce the issue and let you know.
I updated the readme with some additional information under the Advanced
section. Let me know how that works for you and feel free to re-open this issue.
And... we're there!
Thank for your quick response! One problem fixed today, and will most probably save other's time too!
Just also would like to give you an advice, but please, don't take it bad nor too seriously, but AdonisJS is built to make the end-developer write the less code as possible (At least, to me, that's what confidence refers to in AdonisJS), so maybe if your provider could handle it, it would really embrace the Adonis's philosophy and greatly improve it! But again, I doubt you can do it that easily... So I understand if that's to the end-developer to handle such things! Again, and in all case, thank!
I'm trying to use
await auth.attempt(email, password);
in my login controller. If authentication fails, adonis sends automatically a response, which is plain json and therefore a popup window appears saying "All Inertia requests must receive a valid Inertia response, however a plain JSON response was received."It seems that for some reason the automatic response removes the "X-Inertia: true" -header.
I've got a failing authentication working by using try-catch and in catch: