bt-core-app 1.3.2 → 1.3.3
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/bt-core-app.js +2601 -2602
- package/dist/composables/auth.d.ts +2 -2
- package/package.json +1 -1
- package/src/composables/auth.ts +16 -16
|
@@ -36,7 +36,7 @@ export interface CreateAuthOptions {
|
|
|
36
36
|
/**OVERRIDES DEFAULT. use the given code and generate the url to convert to an access token */
|
|
37
37
|
getTokenUrl?: (code: string, redirect_uri: string, grant_type: string, client_id: string) => string;
|
|
38
38
|
/**OVERRIDES DEFAULT. */
|
|
39
|
-
getToken?: () => Promise<void>;
|
|
39
|
+
getToken?: (code?: string, state?: string) => Promise<void>;
|
|
40
40
|
oauthGrantType?: string;
|
|
41
41
|
oauthClientID?: string;
|
|
42
42
|
/**sets current credentials on top of default function
|
|
@@ -57,7 +57,7 @@ export interface BTAuth {
|
|
|
57
57
|
doShowByNav: (navName?: string | AuthItem, includeChildren?: boolean) => boolean;
|
|
58
58
|
getAuthorizeUrl: (redirectPath?: string) => string;
|
|
59
59
|
getTimeZone: () => string;
|
|
60
|
-
getToken: () => Promise<void>;
|
|
60
|
+
getToken: (code?: string, state?: string) => Promise<void>;
|
|
61
61
|
login: (redirectPath?: string) => void;
|
|
62
62
|
logout: (navNameRedirect?: string) => void;
|
|
63
63
|
setAuth: (jwtToken?: string) => void;
|
package/package.json
CHANGED
package/src/composables/auth.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { appendUrl, isLengthyArray } from '../composables/helpers'
|
|
|
2
2
|
import { DateTime } from 'luxon'
|
|
3
3
|
import { type RemovableRef, useStorage } from '@vueuse/core'
|
|
4
4
|
import { type BTDemo } from '../composables/demo'
|
|
5
|
-
import {
|
|
5
|
+
import { useRouter } from 'vue-router'
|
|
6
6
|
import { toValue } from 'vue'
|
|
7
7
|
import { useAuthUrl } from './urls'
|
|
8
8
|
|
|
@@ -48,7 +48,7 @@ export interface CreateAuthOptions {
|
|
|
48
48
|
/**OVERRIDES DEFAULT. use the given code and generate the url to convert to an access token */
|
|
49
49
|
getTokenUrl?: (code: string, redirect_uri: string, grant_type: string, client_id: string) => string
|
|
50
50
|
/**OVERRIDES DEFAULT. */
|
|
51
|
-
getToken?: () => Promise<void>
|
|
51
|
+
getToken?: (code?: string, state?: string) => Promise<void>
|
|
52
52
|
oauthGrantType?: string
|
|
53
53
|
oauthClientID?: string
|
|
54
54
|
/**sets current credentials on top of default function
|
|
@@ -70,7 +70,7 @@ export interface BTAuth {
|
|
|
70
70
|
doShowByNav: (navName?: string | AuthItem, includeChildren?: boolean) => boolean
|
|
71
71
|
getAuthorizeUrl: (redirectPath?: string) => string
|
|
72
72
|
getTimeZone: () => string
|
|
73
|
-
getToken: () => Promise<void>
|
|
73
|
+
getToken: (code?: string, state?: string) => Promise<void>
|
|
74
74
|
login: (redirectPath?: string) => void
|
|
75
75
|
logout: (navNameRedirect?: string) => void
|
|
76
76
|
setAuth: (jwtToken?: string) => void
|
|
@@ -311,13 +311,13 @@ export function createAuth(options: CreateAuthOptions): BTAuth {
|
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
/**defaults to find parameters from route query */
|
|
314
|
-
async function getToken(code?: string, state?: string
|
|
314
|
+
async function getToken(code?: string, state?: string) {
|
|
315
315
|
options.getToken ??= async () => {
|
|
316
|
-
const route = useRoute()
|
|
316
|
+
// const route = useRoute()
|
|
317
317
|
|
|
318
|
-
let mCode = code ?? route.query?.code as string
|
|
319
|
-
let mState = state
|
|
320
|
-
let mRedirectPath = redirect_path ?? route.query?.redirect_path as string
|
|
318
|
+
let mCode = code // ?? route.query?.code as string
|
|
319
|
+
let mState = state //?? route.query?.state as string
|
|
320
|
+
// let mRedirectPath = redirect_path // ?? route.query?.redirect_path as string
|
|
321
321
|
let mGrantType = options.oauthGrantType ?? 'authorization_token'
|
|
322
322
|
let mClientID = options.oauthClientID ?? ''
|
|
323
323
|
|
|
@@ -353,16 +353,16 @@ export function createAuth(options: CreateAuthOptions): BTAuth {
|
|
|
353
353
|
|
|
354
354
|
setAuth(data.value?.access_token)
|
|
355
355
|
|
|
356
|
-
if (mRedirectPath) {
|
|
357
|
-
|
|
358
|
-
}
|
|
359
|
-
else {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
}
|
|
356
|
+
// if (mRedirectPath) {
|
|
357
|
+
// window.location.href = mRedirectPath
|
|
358
|
+
// }
|
|
359
|
+
// else {
|
|
360
|
+
// const router = useRouter()
|
|
361
|
+
// router.push({ name: 'home' })
|
|
362
|
+
// }
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
-
return await options.getToken()
|
|
365
|
+
return await options.getToken(code, state)
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
/**if not demoing, then will decrypt the jwtToken and attempt to set credentials */
|