Wanderlust project: errorType":"invalid_auth"

Hello guys!
I really need your help. Now Im working on Wanderlust project. Ive already done 13 tasks and I`m stuck.
When I open the response object in console, then go the URL I see

{“meta”:{“code”:400,“errorType”:“invalid_auth”,“errorDetail”:“Missing access credentials. See https://developer.foursquare.com/docs/api/configuration/authentication for details.”,“requestId”:“5cc8105fc53093002ca94dfe”},“response”:{}}

I`ve checked everything and don’t understand the problem.

My main.js code just in case:

// Foursquare API Info
const clientId = '512S54CT5DSNUYA4IEL5KP2SL1ONW0Z1L50NCHEXUMRDDECE';
const clientSecret = 'WCZ4RQIRMNXHDYHKC3VOSGJKPBBWS0CX0ITWZIRMJXHHBAQA';
const url = 'https://api.foursquare.com/v2/venues/explore?near=';

// APIXU Info
const apiKey = '680359eb3b7c49879f7151510192804 ';
const forecastUrl = 'https://api.apixu.com/v1/forecast.json?key=';

// Page Elements
const $input = $('#city');
const $submit = $('#button');
const $destination = $('#destination');
const $container = $('.container');
const $venueDivs = [$("#venue1"), $("#venue2"), $("#venue3"), $("#venue4")];
const $weatherDivs = [$("#weather1"), $("#weather2"), $("#weather3"), $("#weather4")];
const weekDays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];

// Add AJAX functions here:
const getVenues = async () => {
	const city = $input.val();
  const urlToFetch = `${url}${city}&limit=10&client_id=${clientId}&client_secret=${clientSecret}&v=20190428`;
  
  try {
    const response = await fetch(urlToFetch);
    if(response.ok) {
      console.log(response);
      const jsonResponse = await response.json();
      console.log(jsonResponse);
    }  else {
      throw new Error('Ooops');
    }
  } catch(error) {
    console.log(error.message);
  }
};

const getForecast = () => {

}


// Render functions
const renderVenues = (venues) => {
  $venueDivs.forEach(($venue, index) => {
    // Add your code here:

    let venueContent = '';
    $venue.append(venueContent);
  });
  $destination.append(`<h2>${venues[0].location.city}</h2>`);
}

const renderForecast = (days) => {
  $weatherDivs.forEach(($day, index) => {
    // Add your code here:


    let weatherContent = '';
    $day.append(weatherContent);
  });
}

const executeSearch = () => {
  $venueDivs.forEach(venue => venue.empty());
  $weatherDivs.forEach(day => day.empty());
  $destination.empty();
  $container.css("visibility", "visible");
  getVenues()
  getForecast()
  return false;
}

$submit.click(executeSearch)
1 Like

I’m doing the same exercise now.

Mine is returning a result.

Here’s the weird thing - I copied & pasted your code and it returned a result too (I’ve replaced it with my own code again so that I’m using my own api keys).