-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Custom error status on AuthenticationStrategy #499
Comments
Thanks for the suggestion - I agree and this should be quite straightforward to add.
I think this is ok, since it will be documented. Also, allowing a |
Nice. I could try to add it, so. |
Yes, that would be helpful! A few pointers: I'd add a vendure/packages/core/src/api/schema/common/common-types.graphql Lines 201 to 204 in db1893a
Then if you run the Then in the AuthService you'd add a vendure/packages/core/src/service/services/auth.service.ts Lines 57 to 60 in db1893a
Also adding an e2e test to https://github.com/vendure-ecommerce/vendure/blob/master/packages/core/e2e/authentication-strategy.e2e-spec.ts would be great. |
@michaelbromley I'm having this error on the types generated form GraphQL schema. Do you know how could I solve that? I can't understand very well why it's happening. I tested manually and the new return worked fine. I started to have this error when I was pushing a wip commit and the pre-hook push ran some commands. |
Oh this is a bit of a pain, but because some types are shared by both the Admin and Shop APIs, they get generated in both the |
Is your feature request related to a problem? Please describe.
I'm developing a custom
AuthenticationStrategy
. It's working fine on the optimistic case.But on my case I need to return custom errors message when a login fail, such as when the account is blocked.
But since the method
authenticate
could return only two types (User
on success case, andfalse
on fail case), I don't have a way to send a detailed error message to frontend display.Describe the solution you'd like
We could change the
authenticate
to return something like that:It's pretty flexible and type safe.
Describe alternatives you've considered
Another way, in order to not have break change, is changing the return type to
Promise<User | false | string>
- but it could be confused about whatstring
means.The text was updated successfully, but these errors were encountered: