Skip to content

About

Google OAuth2 plugin for Vue3 Apps. This uses latest Google Identity Service Library. It also provides set of composables which can be used easily to implement different authentication strategies

Topics

Resources

Stars

189 stars

Watchers

6 watching

Forks

Latest commit

 

History

252 Commits

Folders and files

Repository files navigation

Vue3 Google Sign-in

Build npm npm bundle size npm NPM Docs

Use Google Identity Services with your Vue3 App easily

Documentation

Full documentation can be accessed here

Installation

  • With NPM
npm install -S vue3-google-signin
  • With Yarn
yarn add vue3-google-signin
  • With PNPM
pnpm add vue3-google-signin

Setup the Library

Setting up the library is very simple. In your application entry point(main.js or main.ts) put the following code.

// rest of the code

import GoogleSignInPlugin from "vue3-google-signin";

app.use(GoogleSignInPlugin, {
  clientId: "CLIENT ID OBTAINED FROM GOOGLE API CONSOLE",
});

// other config

app.mount("#app");

With Nuxt

For Nuxt 3 and 4, add the nuxt-vue3-google-signin module. It installs the plugin and auto-imports the component, composables and helpers.

npx nuxi@latest module add nuxt-vue3-google-signin
// nuxt.config.ts
export default defineNuxtConfig({
  modules: ["nuxt-vue3-google-signin"],
  googleSignIn: {
    clientId: "CLIENT ID OBTAINED FROM GOOGLE API CONSOLE",
  },
});

Or leave clientId out and set NUXT_PUBLIC_GOOGLE_SIGN_IN_CLIENT_ID when the server starts. The Nuxt guide covers SSR, sessions, protected pages and server routes.

Development

Requires Node.js 22+ and pnpm. Recommended IDE: VSCode + Vue - Official.

pnpm install
cp .env.example .env   # set VITE_GOOGLE_CLIENT_ID for the dev playground
pnpm dev               # playground (src/App.vue)
pnpm docs:dev          # docs site
pnpm lint
pnpm build             # type-check + library build
pnpm test              # build, then E2E tests (Playwright uses your installed Chrome)

About

Google OAuth2 plugin for Vue3 Apps. This uses latest Google Identity Service Library. It also provides set of composables which can be used easily to implement different authentication strategies

Topics

Resources

Stars

189 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages