400 Bad Request Using Fetch

Hi,

I’m connecting to the meetup OAUTH2 API using a fetch call from by backend.jsw module (moved from client side due to a CORS error). However when I execute the POST request using this fetch I get a 400 Bad Request error. The request works fine from Postman and native browser, but not from the back end code:

export function connectToMeetup( code ){

let url = 'https://secure.meetup.com/oauth2/access?' + 
		'client_id=yyy&' + 
		'client_secret=xxx&' + 
		'grant_type=authorization_code&' +  
		'code=' + code; 
			
return fetch(url, {method: 'get'}).then( (response) => { 
		if (response.ok) { 
  			return response.json(); 
	    } 
	    else { 
			return Promise.reject("Failed to authorise. Error = " + response.status + "-" + response.statusText); 
	    } 
	}).then( (json) => { 
		return json.toString(); 

	}).catch( (err) => { 
		return 'ERROR:' + err; 
		
}); 

}

Any ideas?

Thanks,
Gary

Solved my own problem. Meetup was returning the 400 because of an invalid parameter. Doh!

Hi Gary, but your pubblished code is right ?

I’m experiencing the same problem. Since it was working fine in postman, what did you do wrong? I need some ideas to my problem.

Hi I am experiencing the same problem. Could you indicate which parameter(s) were incorrect?