I am building a youtube clone using youtube v3 api. I used firebase for google sign in.I added scope for youtube using following code :
const provider = new GoogleAuthProvider();provider.addScope("https://www.googleapis.com/auth/youtube.force-ssl");
I am sending a http request using axios to following URL :https://youtube.googleapis.com/youtube/v3/subscriptions?part=snippet&forChannelId=UC0wQBs1G70mUxfxuQ6uhZKA®ionCode=IN&mine=true&key=AIzaSyDwr3F14VsY3rXqmq9dGzR2G_Oyb4QNGVQ
But it gives the following error :
{"error": {"code": 401,"message": "The request uses the <code>mine</code> parameter but is not properly authorized.","errors": [ {"message": "The request uses the <code>mine</code> parameter but is not properly authorized.","domain": "youtube.parameter","reason": "authorizationRequired","location": "mine","locationType": "parameter" }
I used the following code for sending the request :
useEffect(() => { const getSubscriptionData = async ()=>{ try { console.log(token); const value = await axios.get(YT_SUBSCRIPTION_URL , { params : { part : 'snippet,contentDetails', forChannelId : data.snippet.channelId, mine : true, key : YT_API_KEY, access_token : token }, headers : { Authorization : `Bearer ${token}` } }) console.log(value); } catch (error) { console.log(error); } } getSubscriptionData(); }, [data])
what's the problem ?