Fix: Dashboard token naming (#5361)

This commit is contained in:
Mike
2025-09-02 13:31:50 +02:00
committed by GitHub
parent 73ae62eb98
commit c641ce63e3
2 changed files with 11 additions and 13 deletions
@@ -241,6 +241,7 @@ export const useAuthManager = (
*/
const authToken = useAuthCookie()
// NOTE: Refrain from using the name token as it overrides the authToken
/**
* Token used for embedding
*/
@@ -249,7 +250,7 @@ export const useAuthManager = (
/**
* Token used for dashboard sharing
*/
const dashboardToken = computed(() => route.query.token as Optional<string>)
const dashboardToken = computed(() => route.query.dashboardToken as Optional<string>)
/**
* Get the effective auth token
@@ -529,7 +530,8 @@ export const useAuthManager = (
signInOrSignUpWithSso,
logout,
watchAuthQueryString,
inviteToken
inviteToken,
dashboardToken
}
}
@@ -85,9 +85,8 @@ definePageMeta({
})
const { id } = useRoute().params
const { token: urlToken } = useRoute().query
const { result } = useQuery(dashboardQuery, () => ({ id: id as string }))
const { effectiveAuthToken } = useAuthManager()
const { effectiveAuthToken, dashboardToken } = useAuthManager()
const logger = useLogger()
const { isDarkTheme } = useTheme()
const {
@@ -98,15 +97,12 @@ const editDialogOpen = ref(false)
const workspace = computed(() => result.value?.dashboard?.workspace)
const dashboard = computed(() => result.value?.dashboard)
const dashboardUrl = computed(() => {
return urlToken
? `${dashboardsOrigin}/view/${id}?token=${urlToken}&isEmbed=true&theme=${
isDarkTheme.value ? 'dark' : 'light'
}`
: `${dashboardsOrigin}/dashboards/${id}?token=${
effectiveAuthToken.value
}&isEmbed=true&theme=${isDarkTheme.value ? 'dark' : 'light'}`
})
const dashboardUrl = computed(
() =>
`${dashboardsOrigin}/dashboards/${id}?token=${
dashboardToken.value || effectiveAuthToken.value
}&isEmbed=true&theme=${isDarkTheme.value ? 'dark' : 'light'}`
)
const toggleFullScreen = () => {
if (!document.fullscreenElement) {