1.2.32 • Published 5 years ago

vue-login v1.2.32

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

Vue.js plugin to manage authentication in your app.

WIP

Now you can use it only with Laravel Passport as API auth backend, and axios as http client.

To initialize plugin, you should create an axios instance (with your api base url) and vuex store

import vueLogin from 'vue-login';

const store = new Vuex.Store({
    ...
});

const http = axios.create({
  baseURL: 'https://api.example.com'
});

Vue.use(vueLogin, {
  store,
  axios: http,
  client_id: 1,
  client_secret: 'somesecret',
  loginURL: '/oauth/token',
  refreshURL: '/oauth/token',
  profileFetchURL: '/user/auth/profile'
});

Remember: you should use this http instance to make requests in future, because it will contain an auth headers, after user signed in;

Then just use it in any components:

this.$login.signIn(this.username, this.password).then(
    () => {
        console.log(this.profile);
    });

It brings into all your components a computeds: profile, isLoggedIn, userId, tokenExpiresInFromNow so feel free to use it.

Thats it. And your auth is persistant with localStorage.

Other methods:

this.$login.signOut() - just clears auth data

this.$login.refresh() - uses refresh_token to refresh access_token

1.2.32

5 years ago

1.2.31

6 years ago

1.2.30

6 years ago

1.2.29

6 years ago

1.2.28

6 years ago

1.2.27

6 years ago

1.2.26

6 years ago

1.2.25

6 years ago

1.2.24

6 years ago

1.2.23

6 years ago

1.2.22

6 years ago

1.2.21

6 years ago

1.2.20

6 years ago

1.2.19

6 years ago

1.2.18

6 years ago

1.2.17

6 years ago

1.2.16

6 years ago

1.2.15

6 years ago

1.2.14

6 years ago

1.2.13

6 years ago

1.2.12

6 years ago

1.2.11

6 years ago

1.2.10

6 years ago

1.2.9

6 years ago

1.2.8

6 years ago

1.2.7

6 years ago

1.2.6

6 years ago

1.2.5

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago