大家好,我正在使用 youtube API 和 react 来获取 youtube 视频。但我收到错误 createError.js:16 Uncaught (in promise) Error: Request failed with status code 403
API 代码
import axios from 'axios';
export default axios.create
({
baseURL: 'https://www.googleapis.com/youtube/v3',
})
API 密钥安装
handleSubmit = async (searchTerm) => {
const response = await youtube.get('search', {
params: {
part: 'snippet',
maxResults: 5,
key: '[API KEY]',
q: searchTerm,
}
});