vue-gapi

Google API Client Library wrapper for Vue.js

Showing:

Popularity

Downloads/wk

1.8K

GitHub Stars

106

Maintenance

Last Commit

1d ago

Contributors

18

Package

Dependencies

2

License

MIT

Type Definitions

Built-In

Tree-Shakeable

Yes?

Categories

Readme

npm vuejs3

VueGapi

Google API Client Library wrapper for Vue.js

Requirements

Version 2 requires Vue.js v3.x.

If you are looking for a Vue.js v2.x compatible version, use Version 1.

Installation

npm install --save vue-gapi

or

yarn add vue-gapi

Usage

Installing the plugin with gapi.client.init configuration parameters:

import Vue from 'vue'
import VueGapi from 'vue-gapi'

const app = Vue.createApp({})

app.use(VueGapi, {
  apiKey: '<YOUR_API_KEY>',
  clientId: '<YOUR_CLIENT_ID>.apps.googleusercontent.com',
  discoveryDocs: ['https://sheets.googleapis.com/$discovery/rest?version=v4'],
  scope: 'https://www.googleapis.com/auth/spreadsheets',
})

exposes a $gapi global property accessible inside the application:

<script>
  export default {
    methods: {
      login() {
        this.$gapi.login().then(({ currentUser, gapi, hasGrantedScopes }) => {
          console.log({ currentUser, gapi, hasGrantedScopes })
        })
      },
    },
  }
</script>

See Examples for a comprehensive example.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100