devbaji / vue3-google-login

Add Sign In With Google feature to your Vue 3 application
https://github.com/devbaji/vue3-google-login/
MIT License
202 stars 30 forks source link

Hi, I'm currently using nuxt 3 and wanted to know if vue- google-login works with Nuxt 3. #36

Closed francelwebdev closed 1 year ago

francelwebdev commented 1 year ago

Hi, I'm currently using nuxt 3 and wanted to know if vue- google-login works with Nuxt 3.

devbaji commented 1 year ago

Yes it will work with Nuxt3, Initialize vue3-google-login inside the plugins directory. For example, create a file named vue3-google-login.client.ts and place it inside the plugins directory.

:exclamation: Make sure to use .client suffix in the file name to load the plugin only on the client side.


import vue3GoogleLogin from 'vue3-google-login'

export default defineNuxtPlugin((nuxtApp) => { nuxtApp.vueApp.use(vue3GoogleLogin, { clientId: 'YOUR_GOOGLE_CLIENT_ID' }) });

>  :exclamation: While using [GoogleLogin component](#googlelogin-component), make sure it is wrapped inside [`<ClientOnly>`](https://nuxt.com/docs/api/components/client-only) component.
```vue
  <ClientOnly>
    <GoogleLogin :callback="callback" />
  </ClientOnly>