Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@websanova/vue-auth

Package Overview
Dependencies
Maintainers
1
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@websanova/vue-auth - npm Package Compare versions

Comparing version 2.16.3-beta to 2.16.4-beta

docs/StepByStepGuide.md

2

demos/1.x/package.json
{
"dependencies": {
"@websanova/vue-auth": "2.16.3-beta"
"@websanova/vue-auth": "2.16.4-beta"
},

@@ -5,0 +5,0 @@

{
"dependencies": {
"@websanova/vue-auth": "2.16.3-beta",
"@websanova/vue-auth": "2.16.4-beta",
"axios": "0.16.2",

@@ -5,0 +5,0 @@ "vue-axios": "2.0.2"

{
"dependencies": {
"nuxt": "1.0.0-rc3",
"@websanova/vue-auth": "2.16.3-beta",
"@websanova/vue-auth": "2.16.4-beta",
"vue-resource": "1.3.4",

@@ -6,0 +6,0 @@ "axios": "0.16.2",

@@ -47,3 +47,3 @@ {

"dependencies": {
"@websanova/vue-auth": "2.16.3-beta",
"@websanova/vue-auth": "2.16.4-beta",
"axios": "^0.16.2",

@@ -50,0 +50,0 @@ "compression": "^1.6.2",

@@ -11,8 +11,9 @@ # Advanced Guide

```javascript
this.$auth.watch.data = {}; // user object
this.$auth.watch.loaded = true;
this.$auth.watch.authenticated = true;
```
## Dealing with SSR

@@ -29,2 +30,2 @@

For SEO we don't need authentication.
For SEO we don't need authentication.

@@ -12,3 +12,3 @@ # Authentication

~~~
```javascript
bearerAuth: {

@@ -28,3 +28,3 @@ request: function (req, token) {

},
~~~
```

@@ -41,3 +41,3 @@ The driver `request` method receives the `req` and `token` arguments. From there we use an internal `_setHeaders` method. However with the `req` object pretty much anything can be assembled.

~~~
```javascript
authType: 'custom1',

@@ -53,3 +53,3 @@

}
~~~
```

@@ -60,3 +60,3 @@ **Example 2: Token with multiple parts**

~~~
```javascript
authType: 'custom2',

@@ -83,2 +83,2 @@

}
~~~
```

@@ -47,3 +47,3 @@ # Beginners Guide

```
```javascript
$auth.login({

@@ -57,3 +57,3 @@ rememberMe: true,

```
```javascript
$http({

@@ -68,3 +68,2 @@ rememberMe: true,

## Request Lifecycle

@@ -71,0 +70,0 @@

# Change Log
### v2.16.x-beta
* Removed `_invalidToken` check on `http` drivers. The method still exists but is empty.
* Token names can be fully set, no behind the scenes pre-pending.
* Fixed running demos
* Updated docs.
### v2.15.x-beta

@@ -18,3 +25,3 @@

* Fix to check if error contains response in axios driver.
* Fix to check if error contains response in Axios driver.
* Fix for redirect being ignored when using autoLogin on register.

@@ -25,7 +32,7 @@ * Add ability to manually set tokens (for static/dynamic pages).

* Fix invalidToken logout call for axios driver (to match vue-resource driver update).
* Fix invalidToken logout call for Axios driver (to match vue-resource driver update).
### v2.11.x-beta
* Fix axios driver error response intercept.
* Fix Axios driver error response intercept.
* Update so support fall back for token to be stored in cookie if `localStorage` is not supported. Note that the cookie is used as a dud and not meant to be used by server or back-end as part of authentication scheme.

@@ -64,3 +71,3 @@ * Update token name to underscores `auth_token` instead of `auth-token`.

* Update default webpack setup to use Vue 2.x.
* Update default Webpack setup to use Vue 2.x.

@@ -130,4 +137,4 @@ ### v2.4.x-beta

* Better handling for invalid tokens.
* All functions are overrideable now.
* There is a driver file for vue which supports the binding between the plugin and framework. This allows multiple drivers and overrides for any issues between versions in the future and allows full backward compatability.
* All functions are overridable now.
* There is a driver file for vue which supports the binding between the plugin and framework. This allows multiple drivers and overrides for any issues between versions in the future and allows full backward compatibility.
* Reverted from using Vue in the base code and just went back to regular JavaScript (was not really a good idea).

@@ -139,3 +146,3 @@ * Any functions, fields parameters that involve logging in a secondary user are called `other` now.

* The `logout` method can now perform an api request if `makdeRequest` is set to true.
* Switch to Vanilla JavaScriipt (for development). Had some issues with using fancy es6 syntax.
* Switch to Vanilla Javascript (for development). Had some issues with using fancy ES6 syntax.
* Support for drivers allowing more flexibility between different versions (this is still in development).

@@ -142,0 +149,0 @@ * Two auth drivers which are named `bearer` and `basic`.

@@ -11,3 +11,3 @@ # Demos

~~~
```shell
> cd vue-auth

@@ -20,5 +20,5 @@ > npm install

https://192.168.10.10:8002
~~~
```
~~~
```shell
> cd vue-auth

@@ -31,5 +31,5 @@ > npm install

https://192.168.10.10:8001
~~~
```
~~~
```shell
> cd vue-auth

@@ -42,3 +42,3 @@ > npm install

https://192.168.10.10:8003
~~~
```

@@ -55,8 +55,8 @@ **Note:** By default the config for the demos is assuming that it's running on a virtual box on host `0.0.0.0`.

~~~
```json
"scripts": {
"demo": "webpack-dev-server --https --host=0.0.0.0 --port=8002"
}
~~~
```
This command can be run directly with whatever parameters are required locally.

@@ -7,3 +7,3 @@ # Drivers

~~~
```javascript
Vue.use(require('@websanova/vue-auth'), {

@@ -15,4 +15,4 @@ auth: require('@websanova/vue-auth/drivers/auth/bearer.js'),

});
~~~
```
If you are creating a driver a method named `_init` which will receive the current auth scope can be used to check for any dependencies.

@@ -39,3 +39,3 @@ # FAQ

The response from axios is contained within the response object. You should try to `console(res.response)`.
The response from Axios is contained within the response object. You should try to `console(res.response)`.

@@ -42,0 +42,0 @@ ### Why is the body param not sending my data?

# Getting Started
For more details visit the [Beginners Guide]()
For more details visit the [Beginners Guide](https://github.com/websanova/vue-auth/blob/master/docs/BeginnersGuide.md) and the [Step by Step Guide](https://github.com/websanova/vue-auth/blob/master/docs/StepByStepGuide.md)
## FAQ
* [https://github.com/websanova/vue-auth/blob/master/docs/Faq.md#im-getting-an-error-that-router-is-not-found](I'm getting an error that `router` is not found?)
* [https://github.com/websanova/vue-auth/blob/master/docs/Faq.md#ive-logged-in-successfully-but-its-not-working-after](I've logged in successfully but it's not working after?)
* [https://github.com/websanova/vue-auth/blob/master/docs/Faq.md#why-is-the-token-not-being-set](Why is the token not being set?)
* [https://github.com/websanova/vue-auth/blob/master/docs/Faq.md#how-can-i-authenticate-without-using-the-authorization-header](How can I authenticate without using the `Authorization` header?)
* [https://github.com/websanova/vue-auth/blob/master/docs/Faq.md#my-app-has-2-or-more-fields-required-for-authentication](My app has 2 or more fields required for authentication?)
* [https://github.com/websanova/vue-auth/blob/master/docs/Faq.md#i-only-see-error-request-failed-with-status-code-400-text-when-i-print-out-the-error](I only see `Error: Request failed with status code 400...` text when I print out the error?)
* [https://github.com/websanova/vue-auth/blob/master/docs/Faq.md#why-is-the-body-param-not-sending-my-data](Why is the body param not sending my data?)
* [I'm getting an error that `router` is not found?](https://github.com/websanova/vue-auth/blob/master/docs/Faq.md#im-getting-an-error-that-router-is-not-found)
* [I've logged in successfully but it's not working after?](https://github.com/websanova/vue-auth/blob/master/docs/Faq.md#ive-logged-in-successfully-but-its-not-working-after)
* [Why is the token not being set?](https://github.com/websanova/vue-auth/blob/master/docs/Faq.md#why-is-the-token-not-being-set)
* [How can I authenticate without using the `Authorization` header?](https://github.com/websanova/vue-auth/blob/master/docs/Faq.md#how-can-i-authenticate-without-using-the-authorization-header)
* [My app has 2 or more fields required for authentication?](https://github.com/websanova/vue-auth/blob/master/docs/Faq.md#my-app-has-2-or-more-fields-required-for-authentication)
* [I only see `Error: Request failed with status code 400...` text when I print out the error?](https://github.com/websanova/vue-auth/blob/master/docs/Faq.md#i-only-see-error-request-failed-with-status-code-400-text-when-i-print-out-the-error)
* [Why is the body param not sending my data?](https://github.com/websanova/vue-auth/blob/master/docs/Faq.md#why-is-the-body-param-not-sending-my-data)

@@ -38,15 +38,15 @@

```
```javascript
$auth.login({
body: {email: 'email@example.com', password: 'abcd1234'}
});
~~~
```
For `axios` it would be a data parameter.
```
```javascript
$auth.register({
data: {email: 'email@example.com', password: 'abcd1234'}
});
~~~
```

@@ -77,2 +77,2 @@

* Redirect to use if route is not found (set to `false`).
* Redirect to use if route is not found (set to `false`).

@@ -6,5 +6,5 @@ # Installation

~~~
```shell
> npm install @websanova/vue-auth
~~~
```

@@ -15,3 +15,3 @@ The `router` and `http` drivers MUST be set. The drivers are quite small so can be replaced or overridden as necessary.

~~~
```javascript
Vue.http.options.root = 'https://api-demo.websanova.com/api/v1';

@@ -31,7 +31,7 @@

});
~~~
```
### Install with Vue-Axios
~~~
```javascript
import axios from 'axios'

@@ -43,3 +43,3 @@ import VueAxios from 'vue-axios'

Vue.use(VueAuth, {
auth: AuthBearer,
auth: require('@websanova/vue-auth/drivers/auth/bearer.js'),
http: require('@websanova/vue-auth/drivers/http/axios.1.x.js'),

@@ -54,13 +54,11 @@ router: require('@websanova/vue-auth/drivers/router/vue-router.2.x.js')

});
~~~
```
## Install 1.x
~~~
```javascript
> npm install @websanova/vue-auth
~~~
```
~~~
```javascript
Vue.http.options.root = 'https://api-demo.websanova.com/api/v1';

@@ -75,7 +73,7 @@

});
~~~
```
**NOTE:** If you do not set your router as `Vue.router = new VueRouter()` then you will need to feed the `router` in directly through the options. Also true for `http`.
~~~
```javascript
var router = new VueRouter();

@@ -86,2 +84,2 @@ Vue.use(Auth, {

});
~~~
```

@@ -11,3 +11,3 @@ # Methods

~~~
```html
<div v-if="$auth.ready()">

@@ -19,3 +19,3 @@ <vue-router></vue-router>

</div>
~~~
```

@@ -27,3 +27,3 @@ ### redirect

~~~
```javascript
var redirect = this.$auth.redirect();

@@ -34,3 +34,3 @@

});
~~~
```

@@ -42,11 +42,11 @@ ### user

~~~
```html
<div>
{{ $auth.user().email }}
</div>
~~~
```
~~~
```javascript
this.$auth.user(userObject);
~~~
```

@@ -59,8 +59,8 @@

~~~
```html
<a v-if="!$auth.check()" v-link="'/login'">login</a>
<a v-if="$auth.check('admin')">admin</a>
<a v-if="$auth.check(['admin', 'manager')]">manage</a>
<a v-if="$auth.check(['admin', 'manager'])">manage</a>
<a v-if="$auth.check()" v-on:click="$auth.logout()">logout</a>
~~~
```

@@ -71,5 +71,5 @@ ### other

~~~
```html
<a v-if="$auth.other()" v-on:click="logoutOther()">logout other</a>
~~~
```

@@ -81,3 +81,3 @@ ### disableOther

~~~
```javascript
this.$auth.disableOther();

@@ -88,3 +88,3 @@

this.$auth.enableOther();
~~~
```

@@ -101,3 +101,3 @@ ### enableOther

~~~
```javascript
var token = this.$auth.token();

@@ -111,3 +111,3 @@ var token = this.$auth.token('other');

var token = this.$auth.token('test');
~~~
```

@@ -120,3 +120,3 @@

~~~
```javascript
this.$auth.fetch({

@@ -128,3 +128,3 @@ params: {},

});
~~~
```

@@ -139,5 +139,5 @@ ### refresh

~~~
```javascript
this.$auth.refresh({
params: {}, // data: {} in axios
params: {}, // data: {} in Axios
success: function () {},

@@ -147,3 +147,3 @@ error: function () {},

});
~~~
```

@@ -158,5 +158,5 @@ ### register

~~~
```javascript
this.$auth.register({
params: {}, // data: {} in axios
params: {}, // data: {} in Axios
success: function () {},

@@ -169,3 +169,3 @@ error: function () {},

});
~~~
```

@@ -179,5 +179,5 @@ ### login

~~~
```javascript
this.$auth.login({
params: {}, // data: {} in axios
params: {}, // data: {} in Axios
success: function () {},

@@ -190,3 +190,3 @@ error: function () {},

});
~~~
```

@@ -199,3 +199,3 @@ ### logout

~~~
```javascript
this.$auth.logout({

@@ -209,3 +209,3 @@ makeRequest: true,

});
~~~
```

@@ -217,3 +217,3 @@ ### loginOther

~~~
```javascript
this.$auth.loginOther({

@@ -226,3 +226,3 @@ params: {}, // data: {} in axios

});
~~~
```

@@ -235,3 +235,3 @@ ### logoutOther

~~~
```javascript
this.$auth.logoutOther({

@@ -245,3 +245,3 @@ makeRequest: true,

});
~~~
```

@@ -258,3 +258,3 @@ ### oauth2

~~~
```javascript
if (this.$route.query.code) {

@@ -278,2 +278,2 @@ this.$auth.oauth2({

}
~~~
```
# Options
Pretty much all methods are overrideable now in case there any specific issues with a particular version of Vue.
Pretty much all methods are overridable now in case there any specific issues with a particular version of Vue.

@@ -83,3 +83,3 @@ ### token: `[{request: 'Authorization', response: 'Authorization', authType: 'bearer', foundIn: 'header'}, {request: 'token', response: 'token', authType: 'bearer', foundIn: 'response'}]`

* Default oauth2 data that ships with plugin.
* Default Oauth2 data that ships with plugin.
* These can be overridden when calling `oauth2()` method or in the plugin options on init.

@@ -93,3 +93,3 @@

* Returns the current sites url for use in oauth2 redirects back to the site.
* Returns the current sites url for use in Oauth2 redirects back to the site.

@@ -106,3 +106,3 @@ ### cookieDomain: `_cookieDomain`

* Set how the oauth state data from the returned url will get parsed.
* Set how the Oauth state data from the returned url will get parsed.

@@ -109,0 +109,0 @@ ### tokenExpired: `_tokenExpired`

@@ -36,3 +36,3 @@ # Privileges

~~~
```javascript
Vue.router.map({

@@ -63,7 +63,7 @@ '/admin': {

});
~~~
```
**Vue 2.x**
~~~
```javascript
Vue.router = new VueRouter({

@@ -95,2 +95,2 @@ routes: [{

});
~~~
```

@@ -9,3 +9,3 @@ # User

~~~
```javascript
{

@@ -19,15 +19,15 @@ "status": "success",

}
~~~
```
The plugin has a function for parsing this user data when it receives it called `_parseUserData`. The `data` variable there is the `res.json()` or `res.data` object.
~~~
```javascript
function _parseUserData(data) {
return data.data;
}
~~~
```
If a different format is needed simply override this function in the options.
~~~
```javascript
Vue.use(require('vue-auth'), {

@@ -38,2 +38,2 @@ parseUserData: function (data) {

});
~~~
```

@@ -36,5 +36,7 @@ module.exports = {

_invalidToken: function (res) {
if (res.status === 401) {
this.options.logoutProcess.call(this, res, {redirect: this.options.authRedirect});
}
// Removed - should be handled by the app as there are too many considerations here for checking this.
// if (res.status === 401) {
// this.options.logoutProcess.call(this, res, {redirect: this.options.authRedirect});
// }
},

@@ -41,0 +43,0 @@

@@ -22,5 +22,7 @@ module.exports = {

_invalidToken: function (res) {
if (res.status === 401) {
this.options.logoutProcess.call(this, res, {redirect: this.options.authRedirect});
}
// Removed - should be handled by the app as there are too many considerations here for checking this.
// if (res.status === 401) {
// this.options.logoutProcess.call(this, res, {redirect: this.options.authRedirect});
// }
},

@@ -27,0 +29,0 @@

@@ -17,3 +17,3 @@ {

"version": "2.16.3-beta",
"version": "2.16.4-beta",

@@ -20,0 +20,0 @@ "repository": {

@@ -9,2 +9,3 @@ # Vue Auth

* [Getting Started](https://github.com/websanova/vue-auth/blob/master/docs/GettingStarted.md)
* [Step By Step Guide](https://github.com/websanova/vue-auth/blob/master/docs/StepByStepGuide.md)
* [Beginners Guide](https://github.com/websanova/vue-auth/blob/master/docs/BeginnersGuide.md)

@@ -11,0 +12,0 @@ * [Advanced Guide](https://github.com/websanova/vue-auth/blob/master/docs/AdvancedGuide.md)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc