In my Angular 5 / Ionic 3 project, I have Google authentication setup through firebaseauth, and it is working great.
Is there a simple way for me to use that authentication to also access subscription videos in my Youtube account? I'm trying to avoid using the gapi youtube api, and just send auth data with my youtube request.
constructor(public http: HttpClient, private afAuth: AngularFireAuth) {
this.afAuth.auth.currentUser.getIdToken().then(token => this.token = token);
}
getSubscribedVideos() {
+ '&mine=true&part=snippet,id&maxResults=20',
{ headers: new HttpHeaders({ 'Authorization': 'Bearer ' + this.token} })})
.map(data => data['items']);
}
I am getting a 401 "Invalid Credentials" back from the Youtube api. What other data or headers or parameters do I need to send to the youtube api endpoint to authorize the request?
From my package.json:
"@angular/core": "5.2.11",
"ionic-angular": "3.9.2",
"angularfire2": "^5.0.0-rc.11",
"firebase": "^5.4.0",
"rxjs": "5.5.11",