Skip to content

Commit 6a3c24d

Browse files
committed
Initial commit
0 parents  commit 6a3c24d

23 files changed

+18913
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

README.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# vue-authenticate
2+
`vue-authenticate` is easily configurable solution for *Vue.js* that provides local login/registration as well as Social login using Github, Facebook, Google and Twitter OAuth providers.
3+
4+
The best part about this library is that it is not strictly coupled to one request handling library like `vue-resource`. You will be able to use it with different libraries.
5+
6+
For now it is tested to work with `vue-resource` and `axios` (using `vue-axios` wrapper).
7+
8+
This library was inspired by well known authentication library for Angular called [Satellizer](https://github.com/sahat/satellizer) developed by [Sahat Yalkabov](http://sahatyalkabov.com). They share almost identical configuration and API so you can easily switch from Angular to Vue.js project.
9+
10+
## Instalation
11+
`npm install vue-authenticate`
12+
13+
## Usage
14+
```javascript
15+
import Vue from 'vue'
16+
import VueResource from 'vue-resource'
17+
import VueAuthenticate from '../src/index.js'
18+
19+
Vue.use(VueRouter)
20+
Vue.use(VueResource)
21+
22+
Vue.use(VueAuthenticate, {
23+
baseUrl: 'http://localhost:4000',
24+
25+
providers: {
26+
github: {
27+
clientId: '91b3c6a5b8411640e1b3',
28+
redirectUri: 'http://localhost:8080/auth/callback'
29+
}
30+
}
31+
}
32+
```
33+
34+
### Email & password login and registration
35+
```javascript
36+
new Vue({
37+
methods: {
38+
login: function () {
39+
this.$auth.login({ email, password }).then(function () {
40+
// Execute application logic after successful login
41+
})
42+
},
43+
44+
register: function () {
45+
this.$auth.register({ name, email, password }).then(function () {
46+
// Execute application logic after successful registration
47+
})
48+
}
49+
}
50+
})
51+
```
52+
53+
### Social authentication
54+
55+
```javascript
56+
new Vue({
57+
methods: {
58+
authenticate: function (provider) {
59+
this.$auth.authenticate(provider).then(function () {
60+
// Execute application logic after successful social authentication
61+
})
62+
}
63+
}
64+
})
65+
```
66+
67+
```html
68+
<button @click="authenticate('github')">auth Github</button>
69+
<button @click="authenticate('facebook')">auth Facebook</button>
70+
<button @click="authenticate('google')">auth Google</button>
71+
<button @click="authenticate('twitter')">auth Twitter</button>
72+
```
73+
74+
## License
75+
76+
The MIT License (MIT)
77+
78+
Copyright (c) 2017 Davor Grubelić
79+
80+
Permission is hereby granted, free of charge, to any person obtaining a copy of
81+
this software and associated documentation files (the "Software"), to deal in
82+
the Software without restriction, including without limitation the rights to
83+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
84+
the Software, and to permit persons to whom the Software is furnished to do so,
85+
subject to the following conditions:
86+
87+
The above copyright notice and this permission notice shall be included in all
88+
copies or substantial portions of the Software.
89+
90+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
91+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
92+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
93+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
94+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
95+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

gulpfile.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
var gulp = require('gulp'),
2+
connect = require('gulp-connect')
3+
webpack = require('webpack'),
4+
gulpWebpack = require('gulp-webpack')
5+
history = require('connect-history-api-fallback')
6+
7+
gulp.task('compile', function () {
8+
var webpackConfig = require('./test/webpack.config.js')
9+
return gulp.src('./test/index.js')
10+
.pipe(gulpWebpack(webpackConfig, webpack))
11+
.pipe(gulp.dest('./test'))
12+
.pipe(connect.reload())
13+
})
14+
15+
gulp.task('server', function () {
16+
connect.server({
17+
name: 'VueAuthentication',
18+
root: './test',
19+
base: 'test',
20+
port: 8080,
21+
livereload: true,
22+
verbose: true,
23+
middleware: function () {
24+
return [history()]
25+
}
26+
});
27+
})
28+
29+
gulp.task('watch', function () {
30+
gulp.watch(['./test/index.js', './src/**/*.js'], ['compile'])
31+
})
32+
33+
gulp.task('dev', ['compile', 'server', 'watch'])

package.json

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"name": "vue-authenticate",
3+
"version": "1.0.0",
4+
"description": "Authentication library for Vue.js",
5+
"main": "src/index.js",
6+
"scripts": {
7+
"dev": "parallelshell \"node-dev ./test/server.js\" \"gulp dev\""
8+
},
9+
"keywords": [
10+
"vue",
11+
"vuejs",
12+
"auth"
13+
],
14+
"author": {
15+
"name": "Davor Grubelic",
16+
"email": "[email protected]",
17+
"url": "https://dgrubelic.me"
18+
},
19+
"repository": {
20+
"type": "git",
21+
"url": "https://github.com/dgrubelic/vue-authenticate.git"
22+
},
23+
"license": "MIT",
24+
"dependencies": {
25+
"promise-polyfill": "^6.0.2",
26+
"vue": "^2.2.5",
27+
"vue-resource": "^1.2.1"
28+
},
29+
"devDependencies": {
30+
"axios": "^0.15.3",
31+
"babel-core": "^6.24.0",
32+
"babel-loader": "^6.4.1",
33+
"body-parser": "^1.17.1",
34+
"connect-history-api-fallback": "^1.3.0",
35+
"cors": "^2.8.1",
36+
"express": "^4.15.2",
37+
"gulp": "^3.9.1",
38+
"gulp-connect": "^5.0.0",
39+
"gulp-webpack": "^1.5.0",
40+
"node-dev": "^3.1.3",
41+
"oauth": "^0.9.15",
42+
"oauth-signature": "^1.3.1",
43+
"parallelshell": "^2.0.0",
44+
"request": "^2.81.0",
45+
"unix-timestamp": "^0.2.0",
46+
"vue-axios": "^2.0.1",
47+
"vue-router": "^2.3.0",
48+
"webpack": "^2.3.2",
49+
"webpack-dev-server": "^2.4.2"
50+
},
51+
"tags": [
52+
"auth",
53+
"authentication",
54+
"login",
55+
"registration",
56+
"jwt",
57+
"token",
58+
"vuejs",
59+
"vue.js",
60+
"github",
61+
"facebook",
62+
"google",
63+
"twitter",
64+
"oauth",
65+
"oauth 1.0",
66+
"oauth 2.0"
67+
]
68+
}

0 commit comments

Comments
 (0)