Parsing API Key
#2191
-
|
Hello, all: How can I parse my API key in this code? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Answered by
izzqz
Nov 27, 2022
Replies: 1 comment 1 reply
-
|
You're trying to make GET request with json body. To authenticate request for weatherstak, you need to pass your import got from 'got';
const { data } = await got.get('http://api.weatherstack.com/current', {
searchParams: {
access_key: '***',
query: 'New York'
}
}).json();
console.log(data); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
sindresorhus
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You're trying to make GET request with json body. To authenticate request for weatherstak, you need to pass your
access_keyas query parameter. For got itssearchParamsoption:From Weatherstak API Authentication docs