Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rw-api): remove x-api-key from RW API requests #4736

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions pages/api/gfw/[...params].js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down
12 changes: 0 additions & 12 deletions utils/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -97,7 +86,6 @@ export const apiAuthRequest = create({
baseURL: GFW_API,
headers: {
'content-type': 'application/json',
'x-api-key': GFW_API_KEY,
},
}),
...(!isServer && {
Expand Down
Loading