【发布时间】:2021-09-25 14:29:39
【问题描述】:
我遇到了代码问题。
axios({
method: 'post',
url: 'https://id.twitch.tv/oauth2/token',
body: {
client_id: 'a',
client_secret: 'Bearer b',
grant_type: 'client_credentials',}
}).then(response => {
console.log(response);
})
.catch(error => {
console.log(error);
})
结果是:
data: { status: 400, message: 'missing client id' }
但如果我将它们放在 url 中,这种方式效果很好:
url: 'https://id.twitch.tv/oauth2/token?client_id=a&client_secret=b&grant_type=client_credentials',
我的问题是什么? 你也可以给我一个 axios.get 的例子吗?与:
url: 'https://api.twitch.tv/helix/games/top'
headers: {
client_id: 'a',
Authorization: 'Bearer b',
}
【问题讨论】:
标签: react-native api axios twitch twitch-api