title: 401 Unauthorized Access from api request after deploying app to heroku. node. express. axios
body: <p>My landing page works, but when you go to the home page my app makes a GET request to an API (<a href="https://ridb.recreation.gov/docs#/" rel="nofollow noreferrer">https://ridb.recreation.gov/docs#/</a> for info). The pages then stalls. The heroku logs show that the API rejected my request with a 401 unauthorized access. I have my env. variables set up in heroku and the app was working fine locally.</p>
  <p>here is some of the response from the api:</p>
  <pre><code>2020-11-14T00:13:10.041374+00:00 app[web.1]:   response: {
  2020-11-14T00:13:10.041375+00:00 app[web.1]:     status: 401,
  2020-11-14T00:13:10.041375+00:00 app[web.1]:     statusText: 'Unauthorized',
  2020-11-14T00:13:10.041376+00:00 app[web.1]:     headers: {
  2020-11-14T00:13:10.041376+00:00 app[web.1]:       'content-type': 'application/json',
  2020-11-14T00:13:10.041376+00:00 app[web.1]:       'content-length': '33',
  2020-11-14T00:13:10.041377+00:00 app[web.1]:       connection: 'close',
  2020-11-14T00:13:10.041377+00:00 app[web.1]:       server: 'Server',
  2020-11-14T00:13:10.041378+00:00 app[web.1]:       date: 'Sat, 14 Nov 2020 00:13:10 GMT',
  2020-11-14T00:13:10.041378+00:00 app[web.1]:       'x-amz-apigw-id': 'V-IbcGM5oAMF7jw=',
  2020-11-14T00:13:10.041378+00:00 app[web.1]:       'strict-transport-security': 'max-age=31536000; includeSubdomains; always',
  2020-11-14T00:13:10.041379+00:00 app[web.1]:       'cache-control': 'max_age=600,public,stale-if-error=3600',
  2020-11-14T00:13:10.041384+00:00 app[web.1]:       'x-content-type-options': 'nosniff',
  2020-11-14T00:13:10.041385+00:00 app[web.1]:       'x-frame-options': 'SAMEORIGIN',
  2020-11-14T00:13:10.041385+00:00 app[web.1]:       'x-xss-protection': '1; mode=block',
  </code></pre>
  <p>and here is my axios code:</p>
  <p><a href="https://i.stack.imgur.com/JlV0d.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JlV0d.png" alt="my axios api request code" /></a></p>
  <p>I tried adding some 'access-control-allow-origin' options but didn't work.</p>