401 (Unauthorized) code example
Example 1: 401 vs 403
401 Unauthorized VS 403 Forbidden
401 Unauthorized meaning
you did not provide a credential or correct credentials to send the
request
you are encorouranged to try again with correct credentials
403 Forbidden
even you did provide valid credentials
you are not authorized to take this action by who you are
because you do not have authority or permission
Do not bother to try again !
Example 2: HttpErrorResponse {headers: HttpHeaders, status: 401, statusText: "Unauthorized"
//if you are getting this error and are using Firebase it could be that you
//need to set the rules of your Realtime database to true to allow your
//app access to your database:
"rules": {
".read" : true ,
".write": true
}
Example 3: unauthorized status code
HTTP 401 : Unauthorized client error status response code indicates that the request has not been applied because it lacks valid authentication credentials for the target resource
Example 4: http 401 unauthorized
401 Unauthorized