How to recognise an existing Google OAuth authentication made via Firebase and perform a Google Directory API request in Angular 2?

I want to use my existing authentication and be able to use that same authentication to perform a get request to the Google Directory API. Here’s my current code:

login() {
    this.firebaseRef = new Firebase('');
    this.firebaseRef.authWithOAuthPopup("google", (error, authData) => {
        if (error) {
            console.log("Login Failed!", error);
        } else {
            console.log("Authenticated successfully with payload:", authData);
    }, {
            scope: ""

getData() {
    // TO-DO
    // Recognise existing OAuth and perform a GET request to

Leave a Reply

2 Comment threads
0 Thread replies
Most reacted comment
Hottest comment thread
1 Comment authors
Jason Recent comment authors
newest oldest most voted
Notify of

You could leverage the getAuth method on the firebaseRef instance. Something like that:

getData() {
  var authData = this.firebaseRef.getData();
  var provider = authData.provider;
  // In your case provider contains "google"

See this documentation:


I’ve found the solution. I need to use the current access token in the http request headers for the GET request. import {Http, Headers} from 'angular2/http'; getData() { // get access token let authData = this.firebaseRef.getAuth(); let oauthToken =; console.log(oauthToken); // set authorization on request headers let headers = new Headers(); headers.append('Authorization', 'Bearer ' + oauthToken); // api request this.http.get('',{headers: headers}).subscribe((res) => { console.log(res.json()); }); }