vue-google-auth icon indicating copy to clipboard operation
vue-google-auth copied to clipboard

Usage with Nuxt.js

Open Chathula opened this issue 7 years ago • 1 comments

how to use this with nuxt.js

Chathula avatar Dec 13 '17 10:12 Chathula

just found the way...

nuxt.config.js

plugins: [
    { src: '~plugins/google.js', ssr: false, injectAs: 'googleAuth' },
  ]

plugins/google.js

import Vue from 'vue'
import GoogleAuth from 'vue-google-auth'
import { GOOGLE_CLIENT_ID } from '../config/constants'

Vue.use(GoogleAuth, { clientId: GOOGLE_CLIENT_ID })
Vue.googleAuth().load()

export default GoogleAuth

you can now access this inside any vue file

this.$googleAuth().signIn(this.signInCallback, (error) => {
        this.error = 'Google sign in failed'
      });

Chathula avatar Dec 13 '17 10:12 Chathula