carp.sensing-flutter icon indicating copy to clipboard operation
carp.sensing-flutter copied to clipboard

403 error when trying to access a newly created resource

Open SlimShadyIAm opened this issue 9 months ago • 1 comments

Problem

When you are invited to a new study and you are already signed in, and you try to accept the invitation, you will get a 403 error. This is because your token does not have the claims required to access the newly created resource.

Furthermore, when the deployment is null because the backend throws an error such as in this case, an assertion will fail in the research package. This should be handled differently - we should throw an error so the app can handle this error.

Solution

Whenever you get a 403 error, try to refresh the token manually and re-try the request. If it fails again, you really are not supposed to be able to access that request and you should somehow handle that (on the portal we redirect to the homepage and show an error snackbar that you don't have access).

SlimShadyIAm avatar May 06 '24 09:05 SlimShadyIAm

image

bardram avatar May 06 '24 09:05 bardram