next.jsdigital-oceanmedusajs

MedusJs admin giving 401 status on every request


I recently deployed my medusaJs project on digital ocean. the deployment was successful and the backend endpoints are return the necessary JSON information when I hit them with a status of 200. How ever when I try to use my admin panel all my requests in my network tab have a status of 401 and the response is unauthorized. Has anyone encountered the same issue and is their a fix for it?


Solution

  • in that case you either have problem with CORS on your backend so try change it to this according to medusajs docs :

    ADMIN_CORS=/http:\/\/*/
    

    and add MEDUSA_ADMIN_BACKEND_URL which specify the backend url that the requests are send to :

    MEDUSA_ADMIN_BACKEND_URL=http://example.domain.com
    

    medusajs docs

    You can add the following options to the medusa-admin dev command: