@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapni/auth",
3
- "version": "0.0.49",
3
+ "version": "0.0.51",
4
4
  "type": "module",
5
5
  "main": "./dist/TapniAuth.umd.js",
6
6
  "module": "./dist/TapniAuth.es.js",
@@ -328,8 +328,13 @@ export default {
328
328
  }
329
329
  },
330
330
  async exchangeAuthCode(data) {
331
- const [err, response] = await to(AuthService.exchangeAuthCode(data, this.storage));
332
- if (err) return this.errorHandler(err);
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);
@@ -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
@@ -23,8 +23,9 @@ export default [
23
23
  component: Login,
24
24
  },
25
25
  {
26
- path: "/callback/*",
26
+ path: "/callback/saml",
27
27
  name: "Callback",
28
+ alias: ['/callback/okta', '/callback/auth'],
28
29
  component: Callback,
29
30
  },
30
31
  {
@@ -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
- lang: storage.appLanguage,
30
- realm: storage.realm || 'app'
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
- lang: storage.appLanguage,
36
- realm: storage.realm || 'app'
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
@@ -69,6 +69,6 @@ export default {
69
69
  return Api(storage).post('/saml/url', data)
70
70
  },
71
71
  exchangeAuthCode (data, storage) {
72
- return Api(storage).post('/v1/users/auth-code', data)
72
+ return Api(storage).post('/users/auth-code', data)
73
73
  },
74
74
  }
@@ -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