Codecademy Forums

Missing Credentials for Foursquare - Wanderlust

I’ve made it through step 13 in Wanderlust, but the url I get as a response in the console lets me to a page that just says:

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

I’ve tried resetting my credentials with Foursquare and changed the url I’m referencing per @ baybeegyrlg question, but no luck. I also double checked that I am copying my client ID and client secret.

Here’s my code so far in case it’s a different issue.

// Foursquare API Info
const clientId = ‘XJ4BJV4MPQYKDGPN5XXHOR1WICFWGKEOF0HNAJ4SUDAYA1OR’;
const clientSecret = ‘RLIJLGUNOXGA0HJCO0XDJUYCTIE5HDNM4QL3MUJ4RNTY3JNZ’;
const url = ‘https://api.foursquare.com/v2/venues/explore?near=’;

// APIXU Info
const apiKey = ‘2a6798059cde41be9f1213203182112’;
const forecastUrl = ‘http://api.apixu.com/v1/current.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=20181221`
try {
const response = await fetch(urlToFetch);
if (response.ok) {
console.log(response);
}
else {
throw new Error (‘This is an error!’);
}
}
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}`);
}

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 figured it out - it was a browser issue. I was about to make it work with no change in the code by working on the project in Mozilla instead of Chrome.

What sort of browser issue was it? A chrome extension interfering or something?

Honestly _ I can’t remember at this point. I’m sorry!

I had the same problem, first I had a type Error, which I fixed after hours, then I finally got my link and Chrome was the problem. Went to Mozilla and it worked at once, gonna use firefox for coding from now on.

I have encountered the same error but after digging in a lot found out that there was no error in the code nor it was any browser issue.

Please check the whole URL that you’re pasting in the browser from the console. As the URL in the console is pretty lengthy it is only shown in parts using … symbols.
Hence you will get this error if you paste the incomplete URL containing … symbol in the browser.

1 Like