Skip to content
Discussion options

You must be logged in to vote

You're trying to make GET request with json body. To authenticate request for weatherstak, you need to pass your access_key as query parameter. For got its searchParams option:

import got from 'got';

const { data } = await got.get('http://api.weatherstack.com/current', {
	searchParams: {
		access_key: '***',
                query: 'New York'
	}
}).json();

console.log(data);

From Weatherstak API Authentication docs

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@diegotco
Comment options

Answer selected by sindresorhus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants