
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
vue3-google-oauth2
Advanced tools
You can use this plugin vue3-google-login instead to have support for the new Google Identity Services JavaScript library.
Handling Google sign-in and sign-out for Vue3 applications.
Please refer to here for Vue2 applications.
npm install vue3-google-oauth2
yarn add vue3-google-oauth2
import { createApp } from 'vue'
import App from './App.vue'
import GAuth from 'vue3-google-oauth2'
const app = createApp(App)
const gAuthOptions = { clientId: 'YOUR_CLIENT_ID', scope: 'email', prompt: 'consent', fetch_basic_profile: false }
app.use(GAuth, gAuthOptions)
Property | Type | Required | Description |
---|---|---|---|
clientId | String | Required. | The app's client ID, found and created in the Google Developers Console. |
scope | String | Optional. | Default value is profile email . Full list of scopes. |
prompt | String | Optional. | This value using for authCode. The possible values are select_account or consent . Default value is select_account . To get refresh token from auth code, use consent . |
fetch_basic_profile | Boolean | Optional. | If set to true, email profile openid will be automatically added as scope. Default value is true . |
Property | Description | Type |
---|---|---|
instance | return of gapi.auth2.getAuthInstance() | Object |
signIn | function for sign-in | Function |
getAuthCode | function for getting authCode | Function |
signOut | function for sign-out | Function |
We support reactivity by Provide/Injection. Refer to sample project.
Property | Description | Type |
---|---|---|
Vue3GoogleOauth.isInit | it will return reactivity object value({isInit, isAuthorized}) | Object |
Vue3GoogleOauth.isAuthorized | it will return reactivity object value({isInit, isAuthorized}) | Object |
Refer to sample project.
access_token
and refresh_token
on Server-sideTo get access_token
and refresh_token
in server side, the data for redirect_uri
should be postmessage
. postmessage
is magic value for redirect_uri
to get credentials without actual redirect uri.
curl -d "client_id=YOUR_CLIENT_ID&\
client_secret=YOUR_CLIENT_SECRET&\
redirect_uri=postmessage&\
grant_type=authorization_code&\
code=YOUR_AUTH_CODE" https://accounts.google.com/o/oauth2/token
You can check the brower console to check errors which occur during initialization. The most of errors are from inproper setting of google oauth2 credentials setting in Google Developer Console. After changing the settings, you have to do hard refresh to clear your caches.
FAQs
Handling Google sign-in and sign-out for Vue3 applications.
The npm package vue3-google-oauth2 receives a total of 914 weekly downloads. As such, vue3-google-oauth2 popularity was classified as not popular.
We found that vue3-google-oauth2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.