Migration to 2.0.0
March 16, 2026 ยท View on GitHub
Breaking Changes
- Vue 2 support is removed.
2.0.0targets Vue 3 only. - The package is now ESM-only.
- The runtime implementation uses
fetchinstead ofaxios. vueis now a peer dependency instead of a bundled dependency.- The build and maintenance workflow moved from Vue CLI/Babel/ESLint/Prettier to Vite+, TypeScript, and Vitest.
- The composable is now named
useAuthDownload(). - Several legacy option names were replaced with a cleaner API.
Plugin Registration
Before
import Vue from "vue";
import VueAuthHref from "vue-auth-href";
Vue.use(VueAuthHref, {
token: () => store.getters["auth/token"],
});
After
import { createApp } from "vue";
import App from "./App.vue";
import VueAuthHref from "vue-auth-href";
const app = createApp(App);
app.use(VueAuthHref, {
token: () => store.getters["auth/token"],
});
app.mount("#app");
New Composable
2.0.0 adds useAuthDownload() for cases where a directive is too limiting.
import { useAuthDownload } from "vue-auth-href";
const { download, isDownloading, status } = useAuthDownload({
token: () => store.getters["auth/token"],
});
await download({
url: "/api/reports/monthly.csv",
});
Renamed Options
| Before | After |
|---|---|
headerAuthKey | authHeader |
headerAuthValuePrefix | authScheme |
additionalHeaders | headers |
requestInit | request |
removeDelay | cleanupDelay |
beforeDownloadCallback | onBeforeDownload |
onFinishCallback | onSettled |
errorHandler | onError |
downloadingText | loading.text |
downloadingHtml | loading.html |
textMode | loading.mode |
dotsAnimation | loading.animateDots |
overrideInnerHtml | loading.replaceContent |
suggestedFileName | fileName |
Notes
- The directive name remains
v-auth-href. - Raw HTML loading content still exists through
loading.html, so only use it with trusted markup. - Errors are now normalized as
AuthDownloadErrorinstances with stable codes such asmissing_token,http_error, andrequest_failed.