Skip to content
Discussion options

You must be logged in to vote

Figured it out. You need to use window.gapi and wait for the script to load. Here's my working version:

<template>
<div @click="handleAuthClick">Click here</div>
</template>

<script setup>
import { onMounted } from 'vue';

const CLIENT_ID = 'xxxxx';
const API_KEY = 'xxxxx';
const DISCOVERY_DOC = 'https://www.googleapis.com/discovery/v1/apis/calendar/v3/rest';
const SCOPES = 'https://www.googleapis.com/auth/calendar.readonly';

let tokenClient;
let gapiInited = false;
let gisInited = false;

function gapiLoaded() {
    window.gapi.load('client', initializeGapiClient);
}

async function initializeGapiClient() {
    await window.gapi.client.init({
        apiKey: API_KEY,
        discoveryD…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by coamw2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant