Open Chathula opened 6 years ago
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'
});
how to use this with nuxt.js