Reputation: 105
I would like to have access to the youtube channel comments, videos, playlist ect..
In my React app I use react-google-login
to get google google token
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;
Then with the returned googleid I want to query 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))
}
But when the user wants to login I got Error 403: access_denied response, I dont understand why.
In google cloud I enabled in API library I enabled Youtube Data API V3
Upvotes: 2
Views: 3574
Reputation: 116938
This is not an issue with your scopes. The problem is that your application is currently set ot testing phase, as you have not been verified yet. While your application is still in testing you are limited to what you can do until its published and has been though the verification process.
What you need to do is go to google developer console. Then to your project on the left look for the consent screen. Click the button that says Add users. You can add up to 100 users who will be able to use your application while it is in the testing phase.
Tip: remember that videos uploaded for test apps will be set to private until your application has been verified.
Upvotes: 4