REST API: HTTP Status code for auth violation -


i'm implementing rest api , auth module based on jwt. here below http status codes i've defined it:

  • request without auth token: 401 unauthorized
  • auth token expired: 410 unauthorized
  • auth token not contain required claims: 403 forbidden
  • auth violated (i.e. token tampered): ???

in case of token tampering, http status code should use? 401 (unauthorized or 417 (expectation_failed)?

how can tell if token tampered with? seems me can know if it's correct or incorrect. trying use invalid token seem me unauthorized. expectation_failed refers expect header, doesn't seem appropriate here.


Comments

Popular posts from this blog

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -