From 7e93d76da67cbb102c598e0a5cc0abcd751f3aeb Mon Sep 17 00:00:00 2001 From: Willian Viana Date: Tue, 9 Jan 2024 12:26:23 -0300 Subject: [PATCH] fix(rw-api): remove x-api-key from RW API requests --- pages/api/gfw/[...params].js | 5 ----- utils/request.js | 12 ------------ 2 files changed, 17 deletions(-) diff --git a/pages/api/gfw/[...params].js b/pages/api/gfw/[...params].js index 43aa0163bb..a4650f9447 100644 --- a/pages/api/gfw/[...params].js +++ b/pages/api/gfw/[...params].js @@ -3,8 +3,6 @@ import httpProxyMiddleware from 'next-http-proxy-middleware'; import { GFW_API } from 'utils/apis'; import { PROXIES } from 'utils/proxies'; -const GFW_API_KEY = process.env.NEXT_PUBLIC_GFW_API_KEY; - // We never use the `staging-api.resourcewatch.org` const GFW_API_URL = GFW_API; @@ -27,9 +25,6 @@ export default (req, res) => replaceStr: '/', }, ], - headers: { - 'x-api-key': GFW_API_KEY, - }, followRedirects: true, }).catch(async (error) => { res.end(error.message); diff --git a/utils/request.js b/utils/request.js index 049c165777..931fad51d0 100644 --- a/utils/request.js +++ b/utils/request.js @@ -27,9 +27,7 @@ const RESOURCE_WATCH_API_URL = RESOURCE_WATCH_API; // At the moment, the API key is the same const GFW_API_KEY = process.env.NEXT_PUBLIC_GFW_API_KEY; -const GFW_METADATA_API_KEY = GFW_API_KEY; const DATA_API_KEY = GFW_API_KEY; -const RESOURCE_WATCH_API_KEY = GFW_API_KEY; const isServer = typeof window === 'undefined'; @@ -41,9 +39,6 @@ export const apiRequest = create({ ...defaultRequestConfig, ...(isServer && { baseURL: GFW_API_URL, - headers: { - 'x-api-key': GFW_API_KEY, - }, }), ...(!isServer && { baseURL: PROXIES.GFW_API, @@ -68,9 +63,6 @@ export const metadataRequest = create({ ...defaultRequestConfig, ...(isServer && { baseURL: GFW_METADATA_API_URL, - headers: { - 'x-api-key': GFW_METADATA_API_KEY, - }, }), ...(!isServer && { baseURL: PROXIES.METADATA_API, @@ -81,9 +73,6 @@ export const rwRequest = create({ ...defaultRequestConfig, ...(isServer && { baseURL: RESOURCE_WATCH_API_URL, - headers: { - 'x-api-key': RESOURCE_WATCH_API_KEY, - }, }), ...(!isServer && { baseURL: PROXIES.RESOURCE_WATCH_API, @@ -97,7 +86,6 @@ export const apiAuthRequest = create({ baseURL: GFW_API, headers: { 'content-type': 'application/json', - 'x-api-key': GFW_API_KEY, }, }), ...(!isServer && {