diff --git a/server/routes.ts b/server/routes.ts index 7b4e77c..2843140 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -35,9 +35,9 @@ export async function registerRoutes(app: Express): Promise { // If IUCN token is provided, try to validate it if (tokenData.iucnToken) { try { - await axios.get("https://apiv4.iucnredlist.org/api/v4/version", { - headers: { - "Authorization": `Bearer ${tokenData.iucnToken}` + await axios.get("https://api.iucnredlist.org/api/v4/information/api_version", { + params: { + token: tokenData.iucnToken } }); iucnValid = true; @@ -324,8 +324,8 @@ export async function registerRoutes(app: Express): Promise { try { // Check if the API is working by hitting the version endpoint const response = await axios.get("https://api.iucnredlist.org/api/v4/information/api_version", { - headers: { - "Authorization": `Bearer ${iucnToken}` + params: { + token: iucnToken } }); @@ -401,10 +401,8 @@ export async function registerRoutes(app: Express): Promise { try { // Use the v4 API with scientific name endpoint const response = await axios.get("https://api.iucnredlist.org/api/v4/taxa/scientific_name", { - headers: { - "Authorization": `Bearer ${iucnToken}` - }, params: { + token: iucnToken, genus_name: genusName, species_name: speciesName || "" }