tb-vue-google-login

1.0.14 • Public • Published

Vue google login plugin

Usage

Install in your VueJS project:

npm i -s tb-vue-google-login

Import in main.js and install:

import GoogleLoginPlugin from 'tb-vue-google-login'
 
Vue.use(GoogleLoginPlugin, { login: "http://your-website.com/api/login" })
// /login will receive { "token": "ejysdfusdh.alfjsdk.sdfsdfds" }

A global google-login-component tag will be installed.

Add the following tags to your index.html:

<meta name="google-signian-scope" content="profile email">
<meta name="google-signin-client_id"
  content="your-client-id.apps.googleusercontent.com">
<script src="https://apis.google.com/js/platform.js" async defer></script>

Use google-login-component in any component you wish:

<template>
  <div id="auth-popup">
    <google-login-component
      @loginSuccess="loginSuccessHandler">
    </google-login-component>
  </div>
</template>

And you are good to go!

Emitted events and props:

<template>
  <div id="auth-popup">
    <google-login-component
 
      @loginSuccess="methodCalledWhenLoginIsCompletedOnYourSite"
 
      @authSuccess="methodCalledWhenGoogleAuthTokenArrived"
 
      @loginFail="methodCalledWhenLoginFailedOnYourSite"
 
      @authFail="methodCalledWhenGoogleAuthFailed">
 
    </google-login-component>
  </div>
</template>

Package Sidebar

Install

npm i tb-vue-google-login

Weekly Downloads

14

Version

1.0.14

License

MIT

Unpacked Size

24.2 kB

Total Files

8

Last publish

Collaborators

  • tbalint19