XAuth2 - Electron OAuth2 Client
A Fork of vue-authenticate that (hopefully) works in Electron.
XAuth2 is easily configurable solution for Vue.js that provides local login/registration as well as Social login using Github, Facebook, Google and other OAuth providers (see below).
The best part about this library is that it is not strictly coupled to one request handling library like vue-axios. You will be able to use it with different libraries.
For now it is tested to work with vue-resource and axios (using vue-axios wrapper).
NOTE: Version 1.3.0+ default request library is axios
with the vue-axios
wrapper plugin.
This library was inspired by well known authentication library for Angular called Satellizer developed by Sahat Yalkabov. They share almost identical configuration and API so you can easily switch from Angular to Vue.js project.
Supported OAuth providers and configurations
- Facebook (https://github.com/dgrubelic/vue-authenticate/blob/master/src/options.js#L21)
- Google (https://github.com/dgrubelic/vue-authenticate/blob/master/src/options.js#L34)
- Github (https://github.com/dgrubelic/vue-authenticate/blob/master/src/options.js#L49)
- Instagram (https://github.com/dgrubelic/vue-authenticate/blob/master/src/options.js#L61)
- Twitter (https://github.com/dgrubelic/vue-authenticate/blob/master/src/options.js#L72)
- Bitbucket (https://github.com/dgrubelic/vue-authenticate/blob/master/src/options.js#L81)
- LinkedIn (https://github.com/dgrubelic/vue-authenticate/blob/master/src/options.js#L93)
- Microsoft Live (https://github.com/dgrubelic/vue-authenticate/blob/master/src/options.js#L106)
- YouTube by kieraneglin
- Twitch by kieraneglin
- StreamLabs by kieraneglin
- StreamTip by kieraneglin
- Stripe by kieraneglin
Installation
npm install xauth2
Usage
;;; ; VueVue
Email & password login and registration
methods: { this$auth } { this$auth; }
LoginRegister
Social account authentication
methods: { this$auth; }
auth Githubauth Facebookauth Googleauth Twitter
Vuex authentication
Import and initialize all required libraries
// ES6 example; VueVue const vueAuth = Vueprototype$http baseUrl: 'http://localhost:4000'
// CommonJS examplevar Vue = var Vuex = var VueAxios = var VueAuthenticate = var axios = ; VueVue // ES5, CommonJS examplevar vueAuth = VueAuthenticate
Once you have created VueAuthenticate instance, you can use it in Vuex store like this:
Vuex
Later in Vue component, you can dispatch Vuex state action like this:
// You define your store logic here store computed: { return this$storegetters } methods: { this$store }
Custom request and response interceptors
You can easily setup custom request and response interceptors if you use different request handling library.
Important: You must always set both request
and response
interceptors.
/*** This is an example request & response interceptors for axios library*/ Vue