@tapni/auth 0.0.49 → 0.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/TapniAuth.es.js +215 -210
- package/dist/TapniAuth.umd.js +3 -3
- package/package.json +1 -1
- package/src/mixins/auth.mixin.js +7 -2
- package/src/mixins/saml.mixin.js +4 -1
- package/src/routes.js +2 -1
- package/src/services/Api.js +10 -6
- package/src/services/AuthService.js +1 -1
- package/src/views/Callback.vue +2 -1
package/package.json
CHANGED
package/src/mixins/auth.mixin.js
CHANGED
|
@@ -328,8 +328,13 @@ export default {
|
|
|
328
328
|
}
|
|
329
329
|
},
|
|
330
330
|
async exchangeAuthCode(data) {
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
console.log({data});
|
|
332
|
+
const [err, response] = await to(AuthService.exchangeAuthCode(data, this.$storage));
|
|
333
|
+
if (err) {
|
|
334
|
+
console.log({err});
|
|
335
|
+
return this.errorHandler(err);
|
|
336
|
+
}
|
|
337
|
+
console.log(response);
|
|
333
338
|
await this.loginSetup(response);
|
|
334
339
|
await this.getLoggedInAccounts();
|
|
335
340
|
this.loginSuccess(response);
|
package/src/mixins/saml.mixin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Browser } from '@capacitor/browser';
|
|
2
2
|
import UtilService from '@/services/UtilService';
|
|
3
3
|
import { Capacitor } from "@capacitor/core";
|
|
4
|
-
|
|
4
|
+
import { EventBus } from '@/store/event-bus.js';
|
|
5
5
|
export default {
|
|
6
6
|
data () {
|
|
7
7
|
return {
|
|
@@ -70,6 +70,9 @@ export default {
|
|
|
70
70
|
if(this.isNative && this.isIOS) await Browser.close();
|
|
71
71
|
EventBus.$emit('ssoEvent', {name: 'setLoading', data: true})
|
|
72
72
|
if (this.$route.query.code) code = this.$route.query.code
|
|
73
|
+
|
|
74
|
+
console.log(this.display, {code});
|
|
75
|
+
|
|
73
76
|
if (code) {
|
|
74
77
|
if (this.display === 'popup') {
|
|
75
78
|
return window.parent?.postMessage({ code: code, state: this.$route.query.state }, '*');
|
package/src/routes.js
CHANGED
package/src/services/Api.js
CHANGED
|
@@ -14,7 +14,7 @@ export default (storage, refreshTokenAction = false) => {
|
|
|
14
14
|
let apiInstance = axios.create({
|
|
15
15
|
baseURL,
|
|
16
16
|
headers: {
|
|
17
|
-
Authorization: `Bearer ${storage.token}
|
|
17
|
+
...(storage ? { Authorization: `Bearer ${storage.token}` } : {}),
|
|
18
18
|
"X-Client-Name": "sso-" + appInfo.platform,
|
|
19
19
|
"X-Client-Version": appInfo.version
|
|
20
20
|
}
|
|
@@ -26,19 +26,23 @@ export default (storage, refreshTokenAction = false) => {
|
|
|
26
26
|
if (['post', 'put', 'delete'].includes(config.method.toLowerCase())) {
|
|
27
27
|
config.data = {
|
|
28
28
|
...config.data,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
...(storage ? {
|
|
30
|
+
lang: storage.appLanguage,
|
|
31
|
+
realm: storage.realm || 'app'
|
|
32
|
+
} : {}),
|
|
31
33
|
}
|
|
32
34
|
} else if (config.method.toLowerCase() === 'get') {
|
|
33
35
|
config.params = {
|
|
34
36
|
...config.params,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
...(storage ? {
|
|
38
|
+
lang: storage.appLanguage,
|
|
39
|
+
realm: storage.realm || 'app'
|
|
40
|
+
} : {}),
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
// Check refresh token expiration before request is sent
|
|
41
|
-
if (storage.token && !refreshTokenAction) {
|
|
45
|
+
if (storage && storage.token && !refreshTokenAction) {
|
|
42
46
|
const decoded = jwtDecode(storage.token)
|
|
43
47
|
|
|
44
48
|
// Check if access token expired
|
package/src/views/Callback.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
2
|
+
<div class="page-login content-boxed content-boxed-padding">
|
|
3
3
|
<h5 v-if="($route.query.platform ==='android' || $route.query.platform ==='ios') && !isNative" style="text-align: center; width: 80%; margin: 0 auto; margin-top: 260px; ">
|
|
4
4
|
{{ssoLang[this.appLanguage].you_will_be_redirected}}<br>
|
|
5
5
|
{{ssoLang[this.appLanguage].if_redirect_not_directly}}, <span @click="inAppRedirect" style="color: blue; cursor: pointer">{{ssoLang[this.appLanguage].click_here}}</span>.</h5>
|
|
@@ -24,6 +24,7 @@ export default {
|
|
|
24
24
|
},
|
|
25
25
|
|
|
26
26
|
async mounted() {
|
|
27
|
+
console.log('ee');
|
|
27
28
|
if(this.$route.path === '/callback/auth') {
|
|
28
29
|
this.exchangeAuthCode({
|
|
29
30
|
code: this.$route.query.code
|