├── .babelrc ├── .github └── ISSUE_TEMPLATE │ └── bug_report.md ├── LICENSE ├── README.md ├── backend-samples ├── golang │ └── main.go └── python │ └── main.py ├── index.js ├── index.ts ├── package.json ├── sample.html └── tslint.json /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "env", 5 | { 6 | "modules": false, 7 | "targets": { 8 | "browsers": [ 9 | "> 1%", 10 | "last 2 versions", 11 | "not ie <= 8" 12 | ] 13 | } 14 | } 15 | ], 16 | "stage-2" 17 | ], 18 | "plugins": [ 19 | "transform-runtime", 20 | ], 21 | "env": { 22 | "test": { 23 | "presets": [ 24 | "env", 25 | "stage-2" 26 | ], 27 | "plugins": [ 28 | "istanbul" 29 | ] 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-present Jeongwoo Ahn 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DEPRECATED - no longer actively maintained 2 | This plugin does not support the new Google authentication system(GIS). You need to migrate by referring to [this document](https://developers.google.com/identity/oauth2/web/guides/migration-to-gis?hl=en). 3 | 4 | # vue-google-oauth2 5 | Handling Google sign-in and sign-out for Vue.js applications. 6 | 7 | ![npm bundle size](https://img.shields.io/bundlephobia/minzip/vue-google-oauth2.svg) 8 | ![GitHub](https://img.shields.io/github/license/guruahn/vue-google-oauth2.svg) 9 | ![vue-google-oauth2](https://img.shields.io/npm/dt/vue-google-oauth2.svg) 10 | 11 | We support ~~[TypeScript](https://www.typescriptlang.org/)~~ and [Nuxt](https://ko.nuxtjs.org/). 😎 12 | For Vue3 applications, please refer to [here](https://github.com/guruahn/vue3-google-oauth2) 13 | 14 | [Front-end Demo](https://stupefied-darwin-da9533.netlify.com/) 15 | ## Installation 16 | ### Installation with npm 17 | ``` 18 | npm install vue-google-oauth2 19 | ``` 20 | 21 | ### Installation with yarn 22 | ``` 23 | yarn add vue-google-oauth2 24 | ``` 25 | 26 | ## Initialization 27 | ```javascript 28 | //src/main.js 29 | import GAuth from 'vue-google-oauth2' 30 | const gauthOption = { 31 | clientId: 'CLIENT_ID.apps.googleusercontent.com', 32 | scope: 'profile email', 33 | prompt: 'select_account' 34 | } 35 | Vue.use(GAuth, gauthOption) 36 | 37 | ``` 38 | Please Don't use `plus.login` scope. [It will be deprecated.](https://developers.google.com/identity/sign-in/web/quick-migration-guide) 39 | 40 | ### Initialization for Nuxt 41 | 1. creates plug-in file for nuxt 42 | 43 | ```javascript 44 | // plugins/vue-google-oauth2.js 45 | // file name can be changed to whatever you want 46 | import Vue from 'vue' 47 | import GAuth from 'vue-google-oauth2' 48 | 49 | const gauthOption = { 50 | clientId: 'CLIENT_ID.apps.googleusercontent.com', 51 | scope: 'profile email', 52 | prompt: 'select_account' 53 | } 54 | Vue.use(GAuth, gauthOption) 55 | 56 | ``` 57 | 58 | 2. adds plugin to nuxt config file 59 | ```javascript 60 | ... 61 | plugins: [ 62 | ... 63 | './plugins/vue-google-oauth2' 64 | ], 65 | 66 | ... 67 | 68 | ``` 69 | 70 | ## Options 71 | | Property | Type | Required | Description | 72 | |--------------|----------|-----------------|-----------------| 73 | | clientId | String | Required. | The app's client ID, found and created in the Google Developers Console. | 74 | | scope | String | Optional. | Default value is `profile email`. [Full list of scopes](https://developers.google.com/identity/protocols/googlescopes). | 75 | | prompt | String | Optional. | This value using for [authCode.](https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiauth2offlineaccessoptions) The possible values are `select_account` or `consent`. Default value is `select_account`. To get refresh token from auth code, use `consent`.| 76 | | fetch_basic_profile | Boolean | Optional. | If set to true, `email profile openid` will [be automatically added as scope](https://developers.google.com/identity/sign-in/web/sign-in). Default value is `true`. | 77 | 78 | ## Methods 79 | | Property | Description | Type | 80 | |--------------|--------------------|----------| 81 | | GoogleAuth | return of [gapi.auth2.getAuthInstance()](https://developers.google.com/identity/sign-in/web/reference#gapiauth2authresponse) | Object | 82 | | isAuthorized | Whether or not you have auth | Boolean | 83 | | isInit | Whether or not api init | Boolean | 84 | | isLoaded | Whether or not api init. will be deprecated. | Function | 85 | | signIn | function for sign-in | Function | 86 | | getAuthCode | function for getting authCode | Function | 87 | | signOut | function for sign-out | Function | 88 | 89 | 90 | ## Usages 91 | ### Getting authorization code 92 | The `authCode` that is being returned is the `one-time code` that you can send to your backend server, so that the server can exchange for its own access_token and refresh_token. 93 | 94 | The `access_token` and `refresh_token` can be saved in backend storage for reuse and refresh. In this way, you can avoid exposing your api key or secret key whenever you need to use various google APIs. 95 | 96 | ```javascript 97 | const authCode = await this.$gAuth.getAuthCode() 98 | const response = await this.$http.post('http://your-backend-server-api-to-use-authcode', { code: authCode, redirect_uri: 'postmessage' }) 99 | ``` 100 | 101 | ### Sign-in: Directly get back the `access_token` and `id_token` 102 | 103 | ```javascript 104 | const googleUser = await this.$gAuth.signIn() 105 | // googleUser.getId() : Get the user's unique ID string. 106 | // googleUser.getBasicProfile() : Get the user's basic profile information. 107 | // googleUser.getAuthResponse() : Get the response object from the user's auth session. access_token and so on 108 | this.isSignIn = this.$gAuth.isAuthorized 109 | 110 | ``` 111 | 112 | refer to [google signIn reference : GoogleUser](https://developers.google.com/api-client-library/javascript/reference/referencedocs#googleusergetid) 113 | 114 | 115 | ### Sign-out 116 | Handling Google sign-out 117 | ```javascript 118 | const response = await this.$gAuth.signOut() 119 | ``` 120 | 121 | ## Extra - Directly get `access_token` and `refresh_token` on Server-side 122 | To 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. 123 | 124 | ### Curl 125 | ``` 126 | curl -d "client_id=YOUR_CLIENT_ID&\ 127 | client_secret=YOUR_CLIENT_SECRET&\ 128 | redirect_uri=postmessage&\ 129 | grant_type=authorization_code&\ 130 | code=YOUR_AUTH_CODE" https://accounts.google.com/o/oauth2/token 131 | ``` 132 | 133 | ### Sample Code 134 | - [Golang Sample Code](https://github.com/guruahn/vue-google-oauth2/blob/master/backend-samples/golang/main.go) 135 | - [Python Sample Code](https://github.com/guruahn/vue-google-oauth2/blob/master/backend-samples/python/main.py) 136 | - [Front Sample Code](https://github.com/guruahn/vue-google-oauth2-front-sample) 137 | 138 | ## Additional Help 139 | - [sample login page HTML file](https://github.com/guruahn/vue-google-oauth2/blob/master/sample.html). 140 | - [Google API Client Libraries : Methods and Classes](https://developers.google.com/api-client-library/javascript/reference/referencedocs) 141 | - If you are curious of how the entire Google sign-in flow works, please refer to the diagram below 142 | ![Google Sign-in Flow](https://developers.google.com/identity/sign-in/web/server_side_code_flow.png) 143 | 144 | 145 | ## FAQ 146 | ### The failure of initialization happens 147 | You can check the brower console to check errors which occur during initialization. 148 | The most of errors are from inproper setting of google oauth2 credentials setting in Google Developer Console. 149 | After changing the settings, you have to do hard refresh to clear your caches. 150 | ### Type Errors 151 | Follow the documentation provided [here](https://vuejs.org/v2/guide/typescript.html#Augmenting-Types-for-Use-with-Plugins) to add `$gAuth` as a property for preventing lint errors. 152 | 153 | -------------------------------------------------------------------------------- /backend-samples/golang/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "golang.org/x/oauth2" 7 | "golang.org/x/oauth2/google" 8 | ) 9 | 10 | func main() { 11 | // authCode is from frond-end side and only for one time use 12 | authCode := "YOUR_AUTH_CODE" 13 | 14 | conf := &oauth2.Config{ 15 | ClientID: "YOUR_CLIENT_ID", 16 | ClientSecret: "YOUR_CLIENT_SECRET", 17 | RedirectURL: "postmessage", 18 | Endpoint: google.Endpoint, 19 | } 20 | 21 | // exchange auth_code to token including refresh_token 22 | token, err := conf.Exchange(oauth2.NoContext, authCode) 23 | 24 | if err != nil { 25 | fmt.Printf("%s\n", err.Error()) 26 | return 27 | } 28 | 29 | fmt.Printf("access_token: %s\n", token.AccessToken) 30 | fmt.Printf("refresh_token: %s\n", token.RefreshToken) 31 | fmt.Printf("time expirey: %s\n", token.Expiry) 32 | 33 | } 34 | -------------------------------------------------------------------------------- /backend-samples/python/main.py: -------------------------------------------------------------------------------- 1 | # Python example for the exchange of auth code to refresh token 2 | # Reference: https://google-auth-oauthlib.readthedocs.io/en/latest/reference/google_auth_oauthlib.flow.html 3 | from google_auth_oauthlib.flow import Flow 4 | from oauthlib.oauth2.rfc6749.errors import OAuth2Error 5 | 6 | CLIENT_SECRETS_FILE = 'YOUR_CLIENT_SECRETS_FILE' # get this from https://console.cloud.google.com/apis/credentials 7 | 8 | SCOPES = "openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email" # example scopes 9 | 10 | # reference for convenience 11 | def credentials_to_dict(credObject): 12 | return {'token': credObject.token, 13 | 'refresh_token': credObject.refresh_token, 14 | 'token_uri': credObject.token_uri, 15 | 'client_id': credObject.client_id, 16 | 'client_secret': credObject.client_secret, 17 | 'scopes': credObject.scopes} 18 | 19 | if __name__ == "__main__": 20 | auth_code = 'auth_code_from_client' 21 | 22 | flow = Flow.from_client_secrets_file(CLIENT_SECRETS_FILE, SCOPES, redirect_uri="postmessage") 23 | try: 24 | flow.fetch_token(code=auth_code) 25 | except OAuth2Error: 26 | # error handling, for example InvalidGrantError for malformed auth_code 27 | print('An error occured') 28 | 29 | credentials = flow.credentials 30 | 31 | print('access_token:', credentials.token) 32 | print('refresh_token:', credentials.refresh_token) -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 2 | var googleAuth = (function () { 3 | 4 | function installClient() { 5 | var apiUrl = 'https://apis.google.com/js/api.js' 6 | return new Promise((resolve) => { 7 | var script = document.createElement('script') 8 | script.src = apiUrl 9 | script.onreadystatechange = script.onload = function () { 10 | if (!script.readyState || /loaded|complete/.test(script.readyState)) { 11 | setTimeout(function () { 12 | resolve() 13 | }, 500) 14 | } 15 | } 16 | document.getElementsByTagName('head')[0].appendChild(script) 17 | }) 18 | } 19 | 20 | function initClient(config) { 21 | return new Promise((resolve, reject) => { 22 | window.gapi.load('auth2', () => { 23 | window.gapi.auth2.init(config) 24 | .then(() => { 25 | resolve(window.gapi) 26 | }).catch((error) => { 27 | reject(error) 28 | }) 29 | }) 30 | }) 31 | 32 | } 33 | 34 | function Auth() { 35 | if (!(this instanceof Auth)) 36 | return new Auth() 37 | this.GoogleAuth = null /* window.gapi.auth2.getAuthInstance() */ 38 | this.isAuthorized = false 39 | this.isInit = false 40 | this.prompt = null 41 | this.isLoaded = function () { 42 | /* eslint-disable */ 43 | console.warn('isLoaded() will be deprecated. You can use "this.$gAuth.isInit"') 44 | return !!this.GoogleAuth 45 | }; 46 | 47 | this.load = (config, prompt) => { 48 | installClient() 49 | .then(() => { 50 | return initClient(config) 51 | }) 52 | .then((gapi) => { 53 | this.GoogleAuth = gapi.auth2.getAuthInstance() 54 | this.isInit = true 55 | this.prompt = prompt 56 | this.isAuthorized = this.GoogleAuth.isSignedIn.get() 57 | }).catch((error) => { 58 | console.error(error) 59 | }) 60 | }; 61 | 62 | this.signIn = (successCallback, errorCallback) => { 63 | return new Promise((resolve, reject) => { 64 | if (!this.GoogleAuth) { 65 | if (typeof errorCallback === 'function') errorCallback(false) 66 | reject(false) 67 | return 68 | } 69 | this.GoogleAuth.signIn() 70 | .then(googleUser => { 71 | if (typeof successCallback === 'function') successCallback(googleUser) 72 | this.isAuthorized = this.GoogleAuth.isSignedIn.get() 73 | resolve(googleUser) 74 | }) 75 | .catch(error => { 76 | if (typeof errorCallback === 'function') errorCallback(error) 77 | reject(error) 78 | }) 79 | }) 80 | }; 81 | 82 | this.getAuthCode = (successCallback, errorCallback) => { 83 | return new Promise((resolve, reject) => { 84 | if (!this.GoogleAuth) { 85 | if (typeof errorCallback === 'function') errorCallback(false) 86 | reject(false) 87 | return 88 | } 89 | this.GoogleAuth.grantOfflineAccess({ prompt: this.prompt }) 90 | .then(function (resp) { 91 | if (typeof successCallback === 'function') successCallback(resp.code) 92 | resolve(resp.code) 93 | }) 94 | .catch(function (error) { 95 | if (typeof errorCallback === 'function') errorCallback(error) 96 | reject(error) 97 | }) 98 | }) 99 | }; 100 | 101 | this.signOut = (successCallback, errorCallback) => { 102 | return new Promise((resolve, reject) => { 103 | if (!this.GoogleAuth) { 104 | if (typeof errorCallback === 'function') errorCallback(false) 105 | reject(false) 106 | return 107 | } 108 | this.GoogleAuth.signOut() 109 | .then(() => { 110 | if (typeof successCallback === 'function') successCallback() 111 | this.isAuthorized = false 112 | resolve(true) 113 | }) 114 | .catch(error => { 115 | if (typeof errorCallback === 'function') errorCallback(error) 116 | reject(error) 117 | }) 118 | }) 119 | }; 120 | } 121 | 122 | return new Auth() 123 | })(); 124 | 125 | 126 | 127 | 128 | function installGoogleAuthPlugin(Vue, options) { 129 | /* eslint-disable */ 130 | //set config 131 | let GoogleAuthConfig = null 132 | let GoogleAuthDefaultConfig = { scope: 'profile email' } 133 | let prompt = 'select_account' 134 | if (typeof options === 'object') { 135 | GoogleAuthConfig = Object.assign(GoogleAuthDefaultConfig, options) 136 | if (options.scope) GoogleAuthConfig.scope = options.scope 137 | if (options.prompt) prompt = options.prompt 138 | if (!options.clientId) { 139 | console.warn('clientId is required') 140 | } 141 | } else { 142 | console.warn('invalid option type. Object type accepted only') 143 | } 144 | 145 | //Install Vue plugin 146 | Vue.gAuth = googleAuth 147 | Object.defineProperties(Vue.prototype, { 148 | $gAuth: { 149 | get: function () { 150 | return Vue.gAuth 151 | } 152 | } 153 | }) 154 | Vue.gAuth.load(GoogleAuthConfig, prompt) 155 | } 156 | 157 | export default installGoogleAuthPlugin 158 | -------------------------------------------------------------------------------- /index.ts: -------------------------------------------------------------------------------- 1 | import _Vue from 'vue'; 2 | 3 | declare global { 4 | interface Window { gapi: any; } 5 | } 6 | 7 | const googleAuth = ((): any => { 8 | 9 | const installClient = () => { 10 | const apiUrl = 'https://apis.google.com/js/api.js'; 11 | return new Promise((resolve) => { 12 | const script: any = document.createElement('script'); 13 | script.src = apiUrl; 14 | script.onreadystatechange = script.onload = () => { 15 | if (!script.readyState || /loaded|complete/.test(script.readyState)) { 16 | setTimeout(() => { 17 | resolve(); 18 | }, 500); 19 | } 20 | }; 21 | document.getElementsByTagName('head')[0].appendChild(script); 22 | }); 23 | }; 24 | 25 | const initClient = (config: any) => { 26 | return new Promise((resolve, reject) => { 27 | window.gapi.load('auth2', () => { 28 | window.gapi.auth2.init(config) 29 | .then(() => { 30 | resolve(window.gapi); 31 | }).catch((error: any) => { 32 | reject(error); 33 | }); 34 | }); 35 | }); 36 | }; 37 | 38 | const Auth = function (this: any) { 39 | this.GoogleAuth = null; /* window.gapi.auth2.getAuthInstance() */ 40 | this.isAuthorized = false; 41 | this.isInit = false; 42 | this.prompt = null; 43 | this.isLoaded = () => { 44 | // tslint:disable-next-line 45 | console.warn('isLoaded() will be deprecated. You can use "this.$gAuth.isInit"'); 46 | return !!this.GoogleAuth; 47 | }; 48 | 49 | this.load = (config: any, prompt: string) => { 50 | installClient() 51 | .then(() => { 52 | return initClient(config); 53 | }) 54 | .then((gapi: any) => { 55 | this.GoogleAuth = gapi.auth2.getAuthInstance(); 56 | this.isInit = true; 57 | this.prompt = prompt; 58 | this.isAuthorized = this.GoogleAuth.isSignedIn.get(); 59 | }).catch((error) => { 60 | console.error(error); 61 | }); 62 | }; 63 | 64 | this.signIn = (successCallback: any, errorCallback: any) => { 65 | return new Promise((resolve, reject) => { 66 | if (!this.GoogleAuth) { 67 | if (typeof errorCallback === 'function') { 68 | errorCallback(false); 69 | } 70 | reject(false); 71 | return; 72 | } 73 | this.GoogleAuth.signIn() 74 | .then((googleUser: any) => { 75 | if (typeof successCallback === 'function') { 76 | successCallback(googleUser); 77 | } 78 | this.isAuthorized = this.GoogleAuth.isSignedIn.get(); 79 | resolve(googleUser); 80 | }) 81 | .catch((error: any) => { 82 | if (typeof errorCallback === 'function') { 83 | errorCallback(error); 84 | } 85 | reject(error); 86 | }); 87 | }); 88 | }; 89 | 90 | this.getAuthCode = (successCallback: any, errorCallback: any) => { 91 | return new Promise((resolve, reject) => { 92 | if (!this.GoogleAuth) { 93 | if (typeof errorCallback === 'function') { 94 | errorCallback(false); 95 | } 96 | reject(false); 97 | return; 98 | } 99 | this.GoogleAuth.grantOfflineAccess({ prompt: this.prompt }) 100 | .then((resp: any) => { 101 | if (typeof successCallback === 'function') { 102 | successCallback(resp.code); 103 | } 104 | resolve(resp.code); 105 | }) 106 | .catch((error: any) => { 107 | if (typeof errorCallback === 'function') { 108 | errorCallback(error); 109 | } 110 | reject(error); 111 | }); 112 | }); 113 | }; 114 | 115 | this.signOut = (successCallback: any, errorCallback: any) => { 116 | return new Promise((resolve, reject) => { 117 | if (!this.GoogleAuth) { 118 | if (typeof errorCallback === 'function') { 119 | errorCallback(false); 120 | } 121 | reject(false); 122 | return; 123 | } 124 | this.GoogleAuth.signOut() 125 | .then(() => { 126 | if (typeof successCallback === 'function') { 127 | successCallback(); 128 | } 129 | this.isAuthorized = false; 130 | resolve(true); 131 | }) 132 | .catch((error: any) => { 133 | if (typeof errorCallback === 'function') { 134 | errorCallback(error); 135 | } 136 | reject(error); 137 | }); 138 | }); 139 | }; 140 | }; 141 | 142 | return new (Auth as any); 143 | })(); 144 | 145 | 146 | function installGoogleAuthPlugin(Vue: typeof _Vue, options?: any): void { 147 | // set config 148 | let GoogleAuthConfig: any = null; 149 | const GoogleAuthDefaultConfig = { 150 | scope: 'profile email', 151 | }; 152 | let prompt = 'select_account'; 153 | if (typeof options === 'object') { 154 | GoogleAuthConfig = Object.assign(GoogleAuthDefaultConfig, options); 155 | if (options.scope) { 156 | GoogleAuthConfig.scope = options.scope; 157 | } 158 | if (options.prompt) { 159 | prompt = options.prompt; 160 | } 161 | if (!options.clientId) { 162 | // tslint:disable-next-line 163 | console.warn('clientId is required'); 164 | } 165 | } else { 166 | // tslint:disable-next-line 167 | console.warn('invalid option type. Object type accepted only'); 168 | } 169 | 170 | // Install Vue plugin 171 | Object.defineProperties(Vue.prototype, { 172 | $gAuth: { 173 | get: () => { 174 | return googleAuth; 175 | }, 176 | }, 177 | }); 178 | googleAuth.load(GoogleAuthConfig, prompt); 179 | } 180 | // tslint:disable-next-line 181 | export default installGoogleAuthPlugin; 182 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-google-oauth2", 3 | "version": "1.5.10", 4 | "description": "Handling Google Auth2 sign-in and sign-out", 5 | "main": "index.js", 6 | "types": "index.ts", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/guruahn/vue-google-oauth2.git" 13 | }, 14 | "keywords": [ 15 | "vue", 16 | "google", 17 | "authentication", 18 | "gapi", 19 | "signin", 20 | "signout", 21 | "login", 22 | "logout", 23 | "oauth2" 24 | ], 25 | "author": "Jeongwoo Ahn ", 26 | "license": "MIT", 27 | "bugs": { 28 | "url": "https://github.com/guruahn/vue-google-oauth2/issues" 29 | }, 30 | "homepage": "https://github.com/guruahn/vue-google-oauth2#readme" 31 | } -------------------------------------------------------------------------------- /sample.html: -------------------------------------------------------------------------------- 1 | 9 | 10 | 69 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "warning", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "linterOptions": { 7 | "exclude": [ 8 | "node_modules/**" 9 | ] 10 | }, 11 | "rules": { 12 | "quotemark": false, 13 | "indent": [ 14 | true, 15 | "spaces", 16 | 2 17 | ], 18 | "interface-name": false, 19 | "ordered-imports": false, 20 | "object-literal-sort-keys": false, 21 | "no-consecutive-blank-lines": false, 22 | "space-before-function-paren": false, 23 | "only-arrow-functions": false, 24 | "trailing-comma": false, 25 | "no-console": false 26 | } 27 | } --------------------------------------------------------------------------------