cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Scope Authentication required for youtube API

0 Likes
446

While using the youtube API to get the subscriptions,liked videos,upload videos and comments, and update the channel details of the authenticated user in our angular project using youtube APIs,we are getting 403 Forbidden error. It states that request had insufficient authentication scopes.

we have tried applying scope and access token to the API but still we get this error. Could any one help us with this error and provide suggestions based on it. Here I have attached the screenshot of the error message and our code.

Service.ts:

<code> import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { GoogleLoginProvider } from 'angularx-social-login';

@Injectable({
  providedIn: 'root'
})
export class YoutubeService {
  
  private APIURL = "https://youtube.googleapis.com/youtube/v3/";
  private APIKEY ="AIzaSyB40HaKwd0VggftBq8R9sEwQx_NG5xOOWc";
  SocialAuthService: any;
  access_token=localStorage.getItem('token');
  reqHeader:any;
  constructor(private http:HttpClient) {
    const reqHeader = new HttpHeaders().set('Authorization', 'Bearer ' + this.access_token)
    .set('Scope', 'https://www.googleapis.com/auth/youtube.readonly')
   }

  public GetSubscriptions()
  {
    return this.http.get("https://youtube.googleapis.com/youtube/v3/subscriptions?part=snippet%2CcontentDetails&mine=true&key=AIzaSyB40HaKwd0VggftBq8R9sEwQx_NG5xOOWc",this.reqHeader);
  }
 }
}

Accepted Solutions (0)

Answers (0)