marmelab / ra-auth-msal

An auth provider for react-admin which handles authentication using the MSAL
MIT License
4 stars 2 forks source link

Option to hide the "Unauthorized" notification when the user needs to login #5

Closed MarkSFrancis closed 1 year ago

MarkSFrancis commented 1 year ago

This always shows an "Unauthorized" message when the user needs to login, and requireAuth is set to true. This is because the checkAuth method throws an Error.

Should there be an option to hide this message, or even just remove it entirely? From the react-admin docs, it looks like this can be done by rejecting the promise with { message: false }

slax57 commented 1 year ago

You're right! Thanks for the feedback! I think we'll probably keep the error in case redirectOnCheckAuth is false because this is the default RA behavior, but otherwise we can probably hide the error with { message: false }.

MarkSFrancis commented 1 year ago

I'm using redirectOnCheckAuth set to false - can I still have an option to configure hiding the error message, or do I need to override the implementation to hide the error message? I'm happy to contribute by raising a PR for whichever you'd prefer

slax57 commented 1 year ago

Indeed we are not willing to add an extra option for this because the authProvider is quite small and it's easy to fork it to create your own implementation if you are not happy with the provided one. So yeah, in your case I would recommend overriding the implementation. If you are still willing to open a PR to change the error in the case of redirectOnCheckAuth=true, we'd gladly accept it though :slightly_smiling_face: Thanks