Skip to content

Commit c8e7de9

Browse files
committed
bump version 1.3.3
1 parent 21488a9 commit c8e7de9

File tree

6 files changed

+159
-139
lines changed

6 files changed

+159
-139
lines changed

dist/vue-authenticate.common.js

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* vue-authenticate v1.3.2
2+
* vue-authenticate v1.3.3
33
* https://github.com/dgrubelic/vue-authenticate
44
* Released under the MIT License.
55
*/
@@ -39,7 +39,9 @@ function camelCase(name) {
3939
});
4040
}
4141

42-
42+
function isUndefined(value) {
43+
return typeof value === 'undefined'
44+
}
4345

4446

4547

@@ -492,24 +494,28 @@ var defaultOptions = {
492494
logoutUrl: null,
493495
storageType: 'localStorage',
494496
storageNamespace: 'vue-authenticate',
495-
cookieStorage: {},
497+
cookieStorage: {
498+
domain: window.location.hostname,
499+
path: '/',
500+
secure: false
501+
},
496502
requestDataKey: 'data',
497503
responseDataKey: 'data',
498504

499505
/**
500506
* Default request interceptor for Axios library
501507
* @context {VueAuthenticate}
502508
*/
503-
bindRequestInterceptor: function () {
504-
var this$1 = this;
509+
bindRequestInterceptor: function ($auth) {
510+
var tokenHeader = $auth.options.tokenHeader;
505511

506-
this.$http.interceptors.request.use(function (config) {
507-
if (this$1.isAuthenticated()) {
508-
config.headers['Authorization'] = [
509-
this$1.options.tokenType, this$1.getToken()
512+
$auth.$http.interceptors.request.use(function (config) {
513+
if ($auth.isAuthenticated()) {
514+
config.headers[tokenHeader] = [
515+
$auth.options.tokenType, $auth.getToken()
510516
].join(' ');
511517
} else {
512-
delete config.headers['Authorization'];
518+
delete config.headers[tokenHeader];
513519
}
514520
return config
515521
});
@@ -519,11 +525,9 @@ var defaultOptions = {
519525
* Default response interceptor for Axios library
520526
* @contect {VueAuthenticate}
521527
*/
522-
bindResponseInterceptor: function () {
523-
var this$1 = this;
524-
525-
this.$http.interceptors.response.use(function (response) {
526-
this$1.setToken(response);
528+
bindResponseInterceptor: function ($auth) {
529+
$auth.$http.interceptors.response.use(function (response) {
530+
$auth.setToken(response);
527531
return response
528532
});
529533
},
@@ -533,7 +537,7 @@ var defaultOptions = {
533537
name: 'facebook',
534538
url: '/auth/facebook',
535539
authorizationEndpoint: 'https://www.facebook.com/v2.5/dialog/oauth',
536-
redirectUri: null,
540+
redirectUri: window.location.origin + '/',
537541
requiredUrlParams: ['display', 'scope'],
538542
scope: ['email'],
539543
scopeDelimiter: ',',
@@ -546,7 +550,7 @@ var defaultOptions = {
546550
name: 'google',
547551
url: '/auth/google',
548552
authorizationEndpoint: 'https://accounts.google.com/o/oauth2/auth',
549-
redirectUri: null,
553+
redirectUri: window.location.origin,
550554
requiredUrlParams: ['scope'],
551555
optionalUrlParams: ['display'],
552556
scope: ['profile', 'email'],
@@ -561,7 +565,7 @@ var defaultOptions = {
561565
name: 'github',
562566
url: '/auth/github',
563567
authorizationEndpoint: 'https://github.com/login/oauth/authorize',
564-
redirectUri: null,
568+
redirectUri: window.location.origin,
565569
optionalUrlParams: ['scope'],
566570
scope: ['user:email'],
567571
scopeDelimiter: ' ',
@@ -573,18 +577,19 @@ var defaultOptions = {
573577
name: 'instagram',
574578
url: '/auth/instagram',
575579
authorizationEndpoint: 'https://api.instagram.com/oauth/authorize',
576-
redirectUri: null,
580+
redirectUri: window.location.origin,
577581
requiredUrlParams: ['scope'],
578582
scope: ['basic'],
579583
scopeDelimiter: '+',
580-
oauthType: '2.0'
584+
oauthType: '2.0',
585+
popupOptions: { width: null, height: null }
581586
},
582587

583588
twitter: {
584589
name: 'twitter',
585590
url: '/auth/twitter',
586591
authorizationEndpoint: 'https://api.twitter.com/oauth/authenticate',
587-
redirectUri: null,
592+
redirectUri: window.location.origin,
588593
oauthType: '1.0',
589594
popupOptions: { width: 495, height: 645 }
590595
},
@@ -593,7 +598,7 @@ var defaultOptions = {
593598
name: 'bitbucket',
594599
url: '/auth/bitbucket',
595600
authorizationEndpoint: 'https://bitbucket.org/site/oauth2/authorize',
596-
redirectUri: null,
601+
redirectUri: window.location.origin + '/',
597602
optionalUrlParams: ['scope'],
598603
scope: ['email'],
599604
scopeDelimiter: ' ',
@@ -605,7 +610,7 @@ var defaultOptions = {
605610
name: 'linkedin',
606611
url: '/auth/linkedin',
607612
authorizationEndpoint: 'https://www.linkedin.com/oauth/v2/authorization',
608-
redirectUri: null,
613+
redirectUri: window.location.origin,
609614
requiredUrlParams: ['state'],
610615
scope: ['r_emailaddress'],
611616
scopeDelimiter: ' ',
@@ -618,7 +623,7 @@ var defaultOptions = {
618623
name: 'live',
619624
url: '/auth/live',
620625
authorizationEndpoint: 'https://login.live.com/oauth20_authorize.srf',
621-
redirectUri: null,
626+
redirectUri: window.location.origin,
622627
requiredUrlParams: ['display', 'scope'],
623628
scope: ['wl.emails'],
624629
scopeDelimiter: ' ',
@@ -631,7 +636,7 @@ var defaultOptions = {
631636
name: null,
632637
url: '/auth/oauth1',
633638
authorizationEndpoint: null,
634-
redirectUri: null,
639+
redirectUri: window.location.origin,
635640
oauthType: '1.0',
636641
popupOptions: null
637642
},
@@ -640,7 +645,7 @@ var defaultOptions = {
640645
name: null,
641646
url: '/auth/oauth2',
642647
clientId: null,
643-
redirectUri: null,
648+
redirectUri: window.location.origin,
644649
authorizationEndpoint: null,
645650
defaultUrlParams: ['response_type', 'client_id', 'redirect_uri'],
646651
requiredUrlParams: null,
@@ -663,9 +668,9 @@ var defaultOptions = {
663668

664669
var CookieStorage = function CookieStorage(defaultOptions) {
665670
this._defaultOptions = objectExtend({
666-
domain: null,
671+
domain: window.location.hostname,
667672
expires: null,
668-
path: null,
673+
path: '/',
669674
secure: false
670675
}, defaultOptions);
671676
};
@@ -785,7 +790,7 @@ function StorageFactory(options) {
785790
window.sessionStorage.setItem('testKey', 'test');
786791
window.sessionStorage.removeItem('testKey');
787792
return new LocalStorage$2(options.storageNamespace)
788-
} catch (e) { }
793+
} catch (e) {}
789794

790795
case 'cookieStorage':
791796
return new CookieStorage(options.cookieStorage);
@@ -878,7 +883,9 @@ OAuthPopup.prototype._stringifyOptions = function _stringifyOptions () {
878883

879884
var options = [];
880885
for (var optionKey in this$1.popupOptions) {
881-
options.push((optionKey + "=" + (this$1.popupOptions[optionKey])));
886+
if (!isUndefined(this$1.popupOptions[optionKey])) {
887+
options.push((optionKey + "=" + (this$1.popupOptions[optionKey])));
888+
}
882889
}
883890
return options.join(',')
884891
};
@@ -894,7 +901,7 @@ var defaultProviderConfig = {
894901
requiredUrlParams: null,
895902
defaultUrlParams: null,
896903
oauthType: '1.0',
897-
popupOptions: { width: null, height: null }
904+
popupOptions: {}
898905
};
899906

900907
var OAuth = function OAuth($http, storage, providerConfig, options) {
@@ -1013,7 +1020,7 @@ var defaultProviderConfig$1 = {
10131020
redirectUri: 'redirectUri'
10141021
},
10151022
oauthType: '2.0',
1016-
popupOptions: { width: null, height: null }
1023+
popupOptions: {}
10171024
};
10181025

10191026
var OAuth2 = function OAuth2($http, storage, providerConfig, options) {
@@ -1374,8 +1381,6 @@ VueAuthenticate.prototype.authenticate = function authenticate (provider, userDa
13741381
} else {
13751382
return reject(new Error('Authentication failed'))
13761383
}
1377-
}).catch(function () {
1378-
reject(new Error('Authentication error occurred'));
13791384
})
13801385
})
13811386
};

0 commit comments

Comments
 (0)