marmelab/ra-auth-msal

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

MarkSFrancis opened this issue ยท 3 comments

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

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 }.

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

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 ๐Ÿ™‚
Thanks