【问题标题】:Google Oauth Error: 403 access_denied the developer has not given permissionGoogle Oauth 错误:403 access_denied 开发者未授予权限
【发布时间】:2021-07-06 18:04:18
【问题描述】:

我想访问 youtube 频道 cmets、视频、播放列表等。 在我的 React 应用程序中,我使用 react-google-login 来获取 google google 令牌

const login = (props) => {
    
        const clientId = "<OAuthClientIDs>"
    
        const onSuccess = (response) => {
            props.onLogin(response.profileObj);
        }
    
        const onFailure = (response) => {
            console.log(response);
        }
    
        return(
            <div>
                <GoogleLogin
                    scope="https://www.googleapis.com/auth/youtube"
                    clientId={clientId}
                    buttonText="Login"
                    onSuccess={onSuccess}
                    onFailure={onFailure}
                    cookiePolicy={'single_host_origin'}
                    style={{marginTop:"100px"}}
                    isSignedIn={true}
                />
            </div>
        )
    }

export default login;
 

然后我想用返回的 googleid 查询 youtube API

const onLogin = (googleId) => {
    setgoogleId(googleId);
  }

  const logPlayList = () => {
    let header = {
      headers: {
          'Content-Type': 'application/json;charset=UTF-8',
          "Authorization": "Bearer " + googleId.googleId,
      }
    };

    axios.get("https://www.googleapis.com/youtube/v3/playlists?part=snippet&mine=true&key=" + googleId", header)
      .then(response => { console.log(response.data) })
      .catch(error => console.log(error))
  }  

但是当用户想登录时,我得到Error 403: access_denied响应,我不明白为什么。

在谷歌云中,我在 API 库中启用了 Youtube Data API V3

【问题讨论】:

    标签: google-cloud-platform youtube-api google-oauth google-login google-developers-console


    【解决方案1】:

    这不是您的示波器的问题。问题是您的应用程序当前设置为测试阶段,因为您尚未经过验证。虽然您的应用程序仍在测试中,但您只能在应用程序发布之前以及通过验证过程之前执行哪些操作。

    你需要做的是去google developer console。然后在左侧的项目中查找同意屏幕。单击显示添加用户的按钮。您最多可以添加 100 个用户,这些用户将能够在您的应用程序处于测试阶段时使用它。

    提示:请记住,在您的应用通过验证之前,为测试应用上传的视频将设置为私有。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-31
      • 1970-01-01
      • 2018-05-26
      • 2021-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多