joselfonseca / lighthouse-graphql-passport-auth

Add GraphQL mutations to get tokens from passport for https://lighthouse-php.com/
https://lighthouse-php-auth.com/
MIT License
229 stars 56 forks source link

ResetPassword should throw an Exception for invalid tokens #104

Closed FreekVR closed 4 years ago

FreekVR commented 4 years ago

https://github.com/joselfonseca/lighthouse-graphql-passport-auth/blob/master/src/GraphQL/Mutations/ResetPassword.php

Currently, when using an incorrect token or for any other type of error, a custom response with a "message" and "status" is used. Our frontend app however relies on normal exceptions which are returned following the graphQL spec.

The UpdatePassword simply throws a validation error when the "old password" is incorrect (https://github.com/joselfonseca/lighthouse-graphql-passport-auth/blob/master/src/GraphQL/Mutations/UpdatePassword.php) so I'd suggest a validation error for an invalid (reset) token would be consistent.

joselfonseca commented 4 years ago

This is a good one, I think it can be something we can do. if you can make a PR that would be awesome if not i'll find some time to see this as soon as I can.

FreekVR commented 4 years ago

I'm implementing this by extending the class in our app, so as soon as that's working I'll see about sending the PR 👍

joselfonseca commented 4 years ago

Added this here https://github.com/joselfonseca/lighthouse-graphql-passport-auth/pull/107, will go out in the 5.0 release.