@tapni/auth 0.0.170 → 0.0.172
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/README.md +2 -0
- package/dist/.vite/manifest.json +18 -10
- package/dist/.well-known/assetlinks.json +10 -12
- package/dist/.well-known/microsoft-identity-association.json +5 -5
- package/dist/{Account-6F9eRo1R.js → Account-BVGvxZ85.js} +31 -32
- package/dist/{QR-2Izy5Dj4.js → QR-DwjajyG2.js} +3 -3
- package/dist/TapniAuth.es.js +1 -1
- package/dist/TapniAuth.umd.js +9 -9
- package/dist/blank.html +31 -0
- package/dist/{install-co2F1hxN.js → install-B8fBS6C4.js} +752 -996
- package/dist/site.webmanifest +11 -1
- package/dist/style.css +1 -1
- package/dist/{web-NrPZl3qD.js → web-XbruGdlD.js} +2 -5
- package/package.json +64 -55
- package/src/.prettierrc.json +16 -0
- package/src/App.vue +249 -265
- package/src/components/Language.vue +66 -143
- package/src/components/LinkIcon.vue +174 -225
- package/src/components/ModalOverlay.vue +47 -50
- package/src/components/OTP.vue +64 -94
- package/src/components/SSO.vue +80 -111
- package/src/components/SSOPick.vue +93 -148
- package/src/eslint.config.js +15 -0
- package/src/install.js +9 -10
- package/src/main.js +54 -57
- package/src/mixins/apple.mixin.js +56 -54
- package/src/mixins/auth.mixin.js +21 -74
- package/src/mixins/facebook.mixin.js +67 -66
- package/src/mixins/global.mixin.js +107 -109
- package/src/mixins/google.mixin.js +53 -54
- package/src/mixins/mfa-auth.mixin.js +68 -68
- package/src/mixins/microsoft.mixin.js +67 -75
- package/src/mixins/okta.mixin.js +50 -57
- package/src/mixins/qr-auth.mixin.js +111 -107
- package/src/mixins/saml.mixin.js +97 -48
- package/src/router/index.js +6 -6
- package/src/routes.js +60 -66
- package/src/services/Api.js +55 -57
- package/src/services/AuthService.js +75 -75
- package/src/services/CompanyService.js +10 -10
- package/src/services/DeviceService.js +3 -3
- package/src/services/UserService.js +45 -45
- package/src/services/UtilService.js +256 -218
- package/src/store/auth.js +471 -543
- package/src/store/constants.js +1 -1
- package/src/store/event-bus.js +22 -22
- package/src/store/locales/cn.js +442 -458
- package/src/store/locales/de.js +438 -517
- package/src/store/locales/en.js +449 -510
- package/src/store/locales/es.js +442 -524
- package/src/store/locales/fr.js +442 -516
- package/src/store/locales/it.js +442 -514
- package/src/store/locales/kr.js +442 -491
- package/src/store/locales/lang.js +43 -43
- package/src/store/locales/sr.js +439 -492
- package/src/store/locales/tr.js +436 -487
- package/src/store/store.js +6 -6
- package/src/views/Account.vue +169 -207
- package/src/views/Callback.vue +36 -33
- package/src/views/Login.vue +220 -392
- package/src/views/MFA.vue +89 -103
- package/src/views/QR.vue +25 -28
- package/src/views/Register.vue +201 -205
- package/src/views/Reset.vue +132 -135
- package/src/views/Verify.vue +153 -151
- package/src/views/Welcome.vue +61 -60
- /package/dist/{web-L3jORB19.js → web-AXRKjAOB.js} +0 -0
- /package/dist/{web-5VtGcKeU.js → web-IFGkBi0t.js} +0 -0
- /package/dist/{web-AImUTDQQ.js → web-LIfHmYL2.js} +0 -0
package/src/install.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import App from
|
|
1
|
+
import App from './App.vue';
|
|
2
2
|
import auth from './store/auth.js';
|
|
3
3
|
|
|
4
4
|
// Export the component by default
|
|
5
5
|
export default {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
install: (app, { store, apiRoot }) => {
|
|
7
|
+
// Register the component
|
|
8
|
+
app.component('TapniAuth', App);
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
if (!store.hasModule('auth')) {
|
|
11
|
+
store.registerModule('auth', auth);
|
|
12
|
+
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
14
|
+
app.config.globalProperties.$apiRoot = apiRoot;
|
|
15
|
+
}
|
|
17
16
|
};
|
package/src/main.js
CHANGED
|
@@ -1,76 +1,75 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createApp } from 'vue'
|
|
3
|
-
import RootApp from './App.vue'
|
|
4
|
-
import router from './router'
|
|
5
|
-
import VueCookies from 'vue-cookies'
|
|
1
|
+
import '@tapni/styles/dist/index.css';
|
|
2
|
+
import { createApp } from 'vue';
|
|
3
|
+
import RootApp from './App.vue';
|
|
4
|
+
import router from './router';
|
|
5
|
+
import VueCookies from 'vue-cookies';
|
|
6
6
|
import { App } from '@capacitor/app';
|
|
7
7
|
import { Browser } from '@capacitor/browser';
|
|
8
8
|
import store from './store/store.js';
|
|
9
9
|
import { sync } from 'vuex-router-sync';
|
|
10
10
|
|
|
11
|
-
const app = createApp(RootApp)
|
|
11
|
+
const app = createApp(RootApp);
|
|
12
12
|
|
|
13
|
-
app.config.productionTip = false
|
|
13
|
+
app.config.productionTip = false;
|
|
14
14
|
|
|
15
15
|
// Vuex Router Sync
|
|
16
16
|
sync(store, router);
|
|
17
17
|
|
|
18
18
|
// Cookies
|
|
19
|
-
app.use(VueCookies)
|
|
19
|
+
app.use(VueCookies);
|
|
20
20
|
|
|
21
|
-
app.use(router)
|
|
21
|
+
app.use(router);
|
|
22
22
|
|
|
23
|
-
app.use(store)
|
|
24
|
-
|
|
25
|
-
app.mount('#app')
|
|
23
|
+
app.use(store);
|
|
26
24
|
|
|
25
|
+
app.mount('#app');
|
|
27
26
|
|
|
28
27
|
function hasQueryParams(route) {
|
|
29
|
-
|
|
28
|
+
return !!Object.keys(route.query).length;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
router.beforeEach((to, from, next) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
})
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
window.scrollTo(0, 0);
|
|
34
|
+
}, 100);
|
|
35
|
+
|
|
36
|
+
if (!hasQueryParams(to) && hasQueryParams(from)) {
|
|
37
|
+
next({ name: to.name, query: from.query });
|
|
38
|
+
} else {
|
|
39
|
+
next();
|
|
40
|
+
}
|
|
41
|
+
});
|
|
43
42
|
|
|
44
43
|
/**
|
|
45
44
|
* Redirect users to desired profile - DEEP LINKING
|
|
46
45
|
* @param data
|
|
47
46
|
*/
|
|
48
47
|
function redirectToProfile(data) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
48
|
+
if (data && data.url) {
|
|
49
|
+
let url = new URL(data.url);
|
|
50
|
+
let pathname = url.pathname || '';
|
|
51
|
+
let queryParams = url.search || '';
|
|
52
|
+
if (queryParams) queryParams = Object.fromEntries(new URLSearchParams(queryParams));
|
|
53
|
+
else queryParams = {};
|
|
54
|
+
let subdomain = '';
|
|
55
|
+
//['my', 'tapni', 'co']
|
|
56
|
+
let tempArr = url.hostname.split('.');
|
|
57
|
+
if (tempArr.length === 3) subdomain = tempArr[0];
|
|
58
|
+
if (subdomain) queryParams.s = subdomain;
|
|
59
|
+
|
|
60
|
+
// open t.link shorter links in browser
|
|
61
|
+
if (pathname && /[A-Z]/.test(pathname) && !pathname.startsWith('/t/')) {
|
|
62
|
+
Browser.open({ url: url.toString() });
|
|
63
|
+
return router.push('/');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (pathname) {
|
|
67
|
+
router.push({
|
|
68
|
+
path: pathname,
|
|
69
|
+
query: queryParams
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
74
73
|
}
|
|
75
74
|
/**
|
|
76
75
|
* CAPACITOR_CONFIG
|
|
@@ -78,13 +77,12 @@ function redirectToProfile(data) {
|
|
|
78
77
|
* Users who have an app should get the profiles opened in the app ie: tapni.co/tapni
|
|
79
78
|
*/
|
|
80
79
|
App.addListener('appUrlOpen', async function (data) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
})
|
|
80
|
+
if (data.url && data.url.startsWith('tapni://')) data.url = data.url.replace('tapni://', 'https://');
|
|
81
|
+
let url = new URL(data.url);
|
|
82
|
+
if (url.pathname.includes('/callback/')) {
|
|
83
|
+
await router.push({ path: url.pathname, query: Object.fromEntries(new URLSearchParams(url.search)) });
|
|
84
|
+
} else redirectToProfile(data);
|
|
85
|
+
});
|
|
88
86
|
|
|
89
87
|
// When the app is open and you trigger NFC event to open the app
|
|
90
88
|
// App.addListener('appStateChange', async function (l) {
|
|
@@ -93,8 +91,7 @@ App.addListener('appUrlOpen', async function (data) {
|
|
|
93
91
|
|
|
94
92
|
// When the app is closed and NFC event opens the app
|
|
95
93
|
App.getLaunchUrl().then((data) => {
|
|
96
|
-
|
|
94
|
+
redirectToProfile(data);
|
|
97
95
|
});
|
|
98
96
|
|
|
99
|
-
|
|
100
97
|
export { app };
|
|
@@ -1,59 +1,61 @@
|
|
|
1
|
-
import to from 'await-to-js'
|
|
2
|
-
import AuthService from '../services/AuthService'
|
|
3
|
-
import {SignInWithApple} from '@capacitor-community/apple-sign-in';
|
|
1
|
+
import to from 'await-to-js';
|
|
2
|
+
import AuthService from '../services/AuthService';
|
|
3
|
+
import { SignInWithApple } from '@capacitor-community/apple-sign-in';
|
|
4
4
|
|
|
5
|
-
import { jwtDecode } from
|
|
6
|
-
import {EventBus} from '../store/event-bus';
|
|
5
|
+
import { jwtDecode } from 'jwt-decode';
|
|
6
|
+
import { EventBus } from '../store/event-bus';
|
|
7
7
|
export default {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
8
|
+
data() {
|
|
9
|
+
return {
|
|
10
|
+
appleLoad: false
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
computed: {
|
|
14
|
+
displayAppleLogin() {
|
|
15
|
+
return (Capacitor.isNativePlatform() && Capacitor.getPlatform() === 'ios') || (!Capacitor.isNativePlatform() && this.isiOS);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
methods: {
|
|
19
|
+
async appleLogin() {
|
|
20
|
+
this.appleLoad = true;
|
|
21
|
+
const [errAuth, user] = await to(
|
|
22
|
+
SignInWithApple.authorize({
|
|
23
|
+
clientId: 'co.tapni.applelogin',
|
|
24
|
+
redirectURI: 'https://' + window.location.host + '/login',
|
|
25
|
+
scopes: 'email name'
|
|
26
|
+
})
|
|
27
|
+
);
|
|
28
|
+
if (errAuth) return (this.appleLoad = false);
|
|
29
|
+
user.response.tokenData = jwtDecode(user.response.identityToken);
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
if (user && user.response && user.response.identityToken) {
|
|
32
|
+
// Track Referrals
|
|
33
|
+
if (this.referral) user.response.ref = this.referral;
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
// Code Login
|
|
36
|
+
if (this.display === 'popup') user.response_type = 'code';
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
38
|
+
const [err, response] = await to(AuthService.appleSDK(user.response, this.$storex));
|
|
39
|
+
if (err) {
|
|
40
|
+
this.appleLoad = false;
|
|
41
|
+
EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
|
|
42
|
+
return this.errorHandler(err);
|
|
43
|
+
}
|
|
44
|
+
if (response.data.success) {
|
|
45
|
+
if (this.display === 'popup') {
|
|
46
|
+
return window.parent?.postMessage({ code: response.data.auth_code, state: this.$route.query.state }, '*');
|
|
47
|
+
}
|
|
48
|
+
await this.loginSetup(response);
|
|
49
|
+
await this.getLoggedInAccounts();
|
|
50
|
+
this.loginSuccess({ ...response, isModal: this.isModal });
|
|
51
|
+
setTimeout(() => {
|
|
52
|
+
this.appleLoad = false;
|
|
53
|
+
}, 1000);
|
|
54
|
+
} else this.errorSnack(this.ssoLang[this.appLanguage].unexpected_err);
|
|
55
|
+
} else {
|
|
56
|
+
this.appleLoad = false;
|
|
57
|
+
EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
package/src/mixins/auth.mixin.js
CHANGED
|
@@ -1,79 +1,26 @@
|
|
|
1
1
|
import { createNamespacedHelpers } from 'vuex';
|
|
2
2
|
const { mapState, mapActions, mapGetters } = createNamespacedHelpers('auth');
|
|
3
|
-
import GlobalMixin from './global.mixin'
|
|
3
|
+
import GlobalMixin from './global.mixin';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
'renderView',
|
|
27
|
-
'appLanguage'
|
|
28
|
-
])
|
|
29
|
-
},
|
|
30
|
-
methods: {
|
|
31
|
-
...mapActions([
|
|
32
|
-
'setLoggedInAccounts',
|
|
33
|
-
'setLoggedInUserId',
|
|
34
|
-
'getRefreshTokens',
|
|
35
|
-
'setRefreshToken',
|
|
36
|
-
'unsetRefreshToken',
|
|
37
|
-
'setToken',
|
|
38
|
-
'setView',
|
|
39
|
-
'setStorage',
|
|
40
|
-
'updateLang',
|
|
41
|
-
'login',
|
|
42
|
-
'register',
|
|
43
|
-
'verify',
|
|
44
|
-
'reset',
|
|
45
|
-
'exchangeAuthCode',
|
|
46
|
-
'changePassword',
|
|
47
|
-
'newPassword',
|
|
48
|
-
'deleteAccount',
|
|
49
|
-
'registerDevice',
|
|
50
|
-
'addFcmToken',
|
|
51
|
-
'acceptCompanyInvitation',
|
|
52
|
-
'logout',
|
|
53
|
-
'getCompanyBySSOEmail',
|
|
54
|
-
'getLoggedInAccounts',
|
|
55
|
-
'loginUsingQR',
|
|
56
|
-
'getAccountSettings',
|
|
57
|
-
'setRedirectUri',
|
|
58
|
-
'setDisplay',
|
|
59
|
-
'setState',
|
|
60
|
-
'setResponseType',
|
|
61
|
-
'switchAccount',
|
|
62
|
-
'loginSetup',
|
|
63
|
-
'loginSuccess',
|
|
64
|
-
'refreshTokenAction'
|
|
65
|
-
])
|
|
66
|
-
},
|
|
67
|
-
watch: {
|
|
68
|
-
"$route.query": {
|
|
69
|
-
handler: function handler() {
|
|
70
|
-
if (this.$route.query.redirect_uri) this.setRedirectUri(this.$route.query.redirect_uri);
|
|
71
|
-
if (this.$route.query.display) this.setDisplay(this.$route.query.display);
|
|
72
|
-
if (this.$route.query.state) this.setState(this.$route.query.state)
|
|
73
|
-
if (this.$route.query.response_type) this.setResponseType(this.$route.query.response_type);
|
|
74
|
-
if (this.$route.query.realm && this.$storage) this.setRealm(this.$route.query.realm);
|
|
75
|
-
},
|
|
76
|
-
deep: true,
|
|
77
|
-
},
|
|
78
|
-
},
|
|
6
|
+
mixins: [GlobalMixin],
|
|
7
|
+
computed: {
|
|
8
|
+
...mapState(['$storex', 'refreshing', 'loggedInUserId', 'account', 'device', 'loggedInAccounts', 'ssoLang', 'display', 'redirect_uri', 'response_type', 'state', 'allowedOriginsAuth']),
|
|
9
|
+
...mapGetters(['accessToken', 'refreshTokens', 'isLoggedIn', 'renderView', 'appLanguage'])
|
|
10
|
+
},
|
|
11
|
+
methods: {
|
|
12
|
+
...mapActions(['setLoggedInAccounts', 'setLoggedInUserId', 'getRefreshTokens', 'setRefreshToken', 'unsetRefreshToken', 'setToken', 'setView', 'setStorage', 'updateLang', 'login', 'register', 'verify', 'reset', 'exchangeAuthCode', 'changePassword', 'newPassword', 'deleteAccount', 'registerDevice', 'addFcmToken', 'acceptCompanyInvitation', 'logout', 'getCompanyBySSOEmail', 'getLoggedInAccounts', 'loginUsingQR', 'getAccountSettings', 'setRedirectUri', 'setDisplay', 'setState', 'setRealm', 'setResponseType', 'switchAccount', 'loginSetup', 'loginSuccess', 'refreshTokenAction'])
|
|
13
|
+
},
|
|
14
|
+
watch: {
|
|
15
|
+
'$route.query': {
|
|
16
|
+
handler: function handler() {
|
|
17
|
+
if (this.$route.query.redirect_uri) this.setRedirectUri(this.$route.query.redirect_uri);
|
|
18
|
+
if (this.$route.query.display) this.setDisplay(this.$route.query.display);
|
|
19
|
+
if (this.$route.query.state) this.setState(this.$route.query.state);
|
|
20
|
+
if (this.$route.query.response_type) this.setResponseType(this.$route.query.response_type);
|
|
21
|
+
if (this.$route.query.realm) this.setRealm(this.$route.query.realm);
|
|
22
|
+
},
|
|
23
|
+
deep: true
|
|
24
|
+
}
|
|
25
|
+
}
|
|
79
26
|
};
|
|
@@ -1,78 +1,79 @@
|
|
|
1
|
-
import to from 'await-to-js'
|
|
2
|
-
import AuthService from '../services/AuthService'
|
|
1
|
+
import to from 'await-to-js';
|
|
2
|
+
import AuthService from '../services/AuthService';
|
|
3
3
|
import { FacebookLogin } from '@capacitor-community/facebook-login';
|
|
4
|
-
import {EventBus} from
|
|
4
|
+
import { EventBus } from '../store/event-bus';
|
|
5
5
|
|
|
6
6
|
window.fbAsyncInit = function () {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
// eslint-disable-next-line no-undef
|
|
8
|
+
FB.init({
|
|
9
|
+
appId: '202577611527680',
|
|
10
|
+
cookie: true, // enable cookies to allow the server to access the session
|
|
11
|
+
xfbml: true, // parse social plugins on this page
|
|
12
|
+
version: 'v16.0' // use graph api current version
|
|
13
|
+
});
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
// Load the SDK asynchronously
|
|
17
17
|
(function (d, s, id) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
// eslint-disable-next-line one-var
|
|
19
|
+
var js,
|
|
20
|
+
fjs = d.getElementsByTagName(s)[0];
|
|
21
|
+
if (d.getElementById(id)) return;
|
|
22
|
+
js = d.createElement(s);
|
|
23
|
+
js.id = id;
|
|
24
|
+
js.src = 'https://connect.facebook.net/en_US/sdk.js';
|
|
25
|
+
fjs.parentNode.insertBefore(js, fjs);
|
|
26
|
+
})(document, 'script', 'facebook-jssdk');
|
|
25
27
|
|
|
26
28
|
export default {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
29
|
+
data() {
|
|
30
|
+
return {
|
|
31
|
+
facebookLoad: false
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
computed: {
|
|
35
|
+
fbLoginUrl() {
|
|
36
|
+
return 'https://www.facebook.com/v16.0/dialog/oauth?client_id=202577611527680&state={"oauth":"facebook"}&response_type=code%20granted_scopes&scope=email&redirect_uri=https://' + window.location.host + '/login';
|
|
37
|
+
},
|
|
38
|
+
displayFacebookLogin() {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
methods: {
|
|
43
|
+
async facebookLogin() {
|
|
44
|
+
this.facebookLoad = true;
|
|
45
|
+
const FACEBOOK_PERMISSIONS = ['email'];
|
|
46
|
+
const [errAuth, user] = await to(FacebookLogin.login({ permissions: FACEBOOK_PERMISSIONS }));
|
|
47
|
+
if (errAuth) return (this.facebookLoad = false);
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
// Track Referrals
|
|
50
|
+
if (this.referral) user.ref = this.referral;
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
if (this.display === 'popup') user.response_type = 'code';
|
|
51
53
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
54
|
+
if (user && user.accessToken) {
|
|
55
|
+
const [err, response] = await to(AuthService.facebookSDK(user, this.$storex));
|
|
56
|
+
if (err) {
|
|
57
|
+
this.facebookLoad = false;
|
|
58
|
+
EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
|
|
59
|
+
return this.errorHandler(err);
|
|
60
|
+
}
|
|
61
|
+
if (response.data.success) {
|
|
62
|
+
if (this.display === 'popup') {
|
|
63
|
+
return window.parent?.postMessage({ code: response.data.auth_code, state: this.$route.query.state }, '*');
|
|
64
|
+
}
|
|
65
|
+
await this.loginSetup(response);
|
|
66
|
+
await this.getLoggedInAccounts();
|
|
67
|
+
this.$router.push('/' + response.data.data.username + '#edit');
|
|
68
|
+
setTimeout(() => {
|
|
69
|
+
this.facebookLoad = false;
|
|
70
|
+
EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
|
|
71
|
+
}, 1000);
|
|
72
|
+
} else this.errorSnack(this.ssoLang[this.appLanguage].unexpected_err);
|
|
73
|
+
} else {
|
|
74
|
+
this.facebookLoad = false;
|
|
75
|
+
EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|