401 unauthorized error react code example

Example 1: 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 2: ActiveResource::UnauthorizedAccess: Failed. Response code = 401. Response message = Unauthorized ([API] Invalid API key or access token (unrecognized login or wrong password))

require 'shopify_api'

shop_url = "https://fooID:[email protected]"
ShopifyAPI::Base.site = 'https://fooStoreName.myshopify.com'
ShopifyAPI::Base.api_version = "2020-01"

# Get a specific product
product = ShopifyAPI::Product.find(14617660364)