I'm currently using Firebase with Google Sign-In in an Angular project.
I would like to access the Google Calendar API. I think lot of steps described in the google documentation are unnecessary since Firebase Google Sign-In already return an access token and a refresh token.
Below is the code from the firebase documentation.
And it seems we can actually access the google API after the signInWithPopup method :
This gives you a Google Access Token. You can use it to access the Google API.
firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a Google Access Token. You can use it to access the Google API.
var token = result.credential.accessToken;
// The signed-in user info.
var user = result.user;
// ...
});
Here is my code where i added the calendar in the scope.
let provider = new firebase.auth.GoogleAuthProvider();
provider.addScope("https://www.googleapis.com/auth/calendar.readonly");
this.afAuth.auth.signInWithPopup(provider).then(function(result) {
// ...
});
So, what is the next step? How do i actually access the calendar and let say, return a list of my calendars or list of events?