Hi,
I am using auth0-react-samples and more specifically 02-Calling-an-API example code. I have it working for success scenarios and returns JWT which works with my API.
Problem: I have some rules that check for some values and based on that return a UnauthorizedError
return callback(new UnauthorizedError(
‘User has no profiles for this application.’
));
How do I get this error in SPA and show it to user?
I saw https://github.com/auth0-samples/auth0-react-samples/blob/master/02-Calling-an-API/src/react-auth0-spa.js#L26-L29 but shouldn’t auth0FromHook.handleRedirectCallback() handle it and return error obj or something.
I found React Quickstart can't parse token in handleRedirectCallback - #5 by carolin but their solution of deleting the rule don’t work for us. We want the error message so use knows they are not allowed.
Also do I have to explicitly logout this user from app, if rules failed or it happens on auth0 end?
Thanks.