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 1.4.0-beta to 1.5.0-beta

2

package.json

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

"version": "1.4.0-beta",
"version": "1.5.0-beta",

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

@@ -86,2 +86,41 @@ # Vue Auth

## User Data
A common gotcha is getting the `$auth.user()` data properly. The plugin is designed to expect the user object to be in the `data` parameter of the response.
Depending on what version of the `vue-resource` plugin you are using the response data itself will come from either `res.json()` or `res.data`. Note that the data here is not the response data.
Sample response.
~~~
{
"status": "success",
"data": {
"id": 1,
"name": "Websanova",
...
}
}
~~~
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.
~~~
function _parseUserData(data) {
return data.data;
}
~~~
If a different format is needed simply override this function in the options.
~~~
Vue.use(require('vue-auth'), {
_parseUserData: function (data) {
return data.whatever;
}
});
~~~
## Authentication

@@ -149,6 +188,8 @@

req.headers.set('header1', token[0]);
req.headers.set('header2', token[1]);
req.headers.set('header3', token[2]);
req.headers.set('header4', token[3]);
this.options._setHeaders.call(this, req {
header1: token[0],
header2: token[1],
header3: token[2],
header4: token[3]
});
},

@@ -155,0 +196,0 @@ response: function (res) {

@@ -406,2 +406,3 @@ var __utils = require('./lib/utils.js'),

},
response: function (res) {

@@ -422,2 +423,3 @@ var token = this.options._getHeaders.call(this, res).Authorization;

},
response: function (res) {

@@ -428,2 +430,32 @@ var token = this.options._getHeaders.call(this, res).Authorization;

}
},
deviseAuth: {
tokens: ['Token-Type', 'Access-Token', 'Client', 'Uid', 'Expiry'],
request: function (req, token) {
var headers = {},
tokens = token.split(';');
this.options.deviseAuth.tokens.forEach(function (tokenName, index) {
if (tokens[index]) {
headers[tokenName] = tokens[index];
}
});
this.options._setHeaders.call(this, req, headers);
},
response: function (res) {
var token = [],
headers = this.options._getHeaders.call(this, res);
this.options.deviseAuth.tokens.forEach(function (tokenName) {
if (headers[tokenName]) {
token.push(headers[tokenName]);
}
});
return token.join(';');
}
}

@@ -430,0 +462,0 @@ };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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