Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage with Nuxt.js #10

Open
Chathula opened this issue Dec 13, 2017 · 1 comment
Open

Usage with Nuxt.js #10

Chathula opened this issue Dec 13, 2017 · 1 comment

Comments

@Chathula
Copy link

how to use this with nuxt.js

@Chathula
Copy link
Author

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'
      });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant