获取错误:createError.js:16 Uncaught (in promise) 错误:请求失败,状态码为 403

时间:2021-01-30 05:48:37

标签: javascript reactjs youtube youtube-api

大家好,我正在使用 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,
    }
  });

Screenshot of error

0 个答案:

没有答案