Use Google Access Token given by firebase auth to access google calendar

Im trying to access users Google calendar after logging in with firebase:

// Initialize Firebase
    var config = {
        apiKey: "---",
        authDomain: "",
        databaseURL: "",
        projectId: "talmitime-app",
        storageBucket: "",
        messagingSenderId: "905541320155",
        clientId: ""
    var db = firebase.firestore();

    function login() {
        var provider = new firebase.auth.GoogleAuthProvider();

        firebase.auth().getRedirectResult().then(function (result) {
            if (result.credential) {
                // 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;
            .catch(function (error) {
                // Handle Errors here.
                var errorCode = error.code;
                var errorMessage = error.message;
                // The email of the user's account used.
                var email =;
                // The firebase.auth.AuthCredential type that was used.
                var credential = error.credential;
                // ...

so i dont know how to go on from here. im a high school student and i’ve tried following some guides but nothing seems to work. i want to be able to add new events to the user’s google calendar. please help me by being specific 🙂