Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
5a334cf
* fix(playground): html w3c errors
Harm-Nullix Dec 31, 2025
c7f0add
* chore: update @teamhanko/hanko-elements to 2.3.0
Harm-Nullix Dec 31, 2025
49f83fc
* feat(composables): useHanko only uses one instance of Hanko to prev…
Harm-Nullix Dec 31, 2025
218ecca
chore: release v2.0.0
Harm-Nullix Jan 3, 2026
bdb2127
* update to own package
Harm-Nullix Jan 3, 2026
0189614
chore: release v2.0.0
Harm-Nullix Jan 3, 2026
eaad998
chore: release v2.0.1
Harm-Nullix Jan 3, 2026
b00d0fb
chore: release v2.0.1
Harm-Nullix Jan 3, 2026
499fa27
chore: release v2.0.2
Harm-Nullix Jan 3, 2026
0978cd8
chore: release v2.0.3
Harm-Nullix Jan 3, 2026
60ff881
chore: release v2.0.4
Harm-Nullix Jan 3, 2026
982b1d4
chore: release v2.0.5
Harm-Nullix Jan 3, 2026
e8d584f
* use `nuxtApp.provide` instead of `useState` for singleton pattern f…
Harm-Nullix Jan 5, 2026
df09451
docs: update README to clarify `useHanko` and `$hanko` usage and impr…
Harm-Nullix Jan 5, 2026
ddb6475
Merge branch 'merge-to-hanko' into v2
Harm-Nullix Jan 5, 2026
8eaf91e
chore: release v2.1.0
Harm-Nullix Jan 5, 2026
2ccce1b
refactor: replace `$hanko` with `useHanko` in middleware functions
Harm-Nullix Jan 5, 2026
6ae13dd
Merge branch 'main' into merge-to-hanko
Harm-Nullix Mar 4, 2026
6c7e230
chore: release v2.5.0
Harm-Nullix Mar 4, 2026
ebb51bd
v2 hank v 2.5
Harm-Nullix Mar 4, 2026
5394bac
chore: release v2.5.0
Harm-Nullix Mar 4, 2026
3f3a852
chore: release v2.5.1
Harm-Nullix Mar 4, 2026
5334338
chore: release v2.5.2
Harm-Nullix Mar 4, 2026
4394181
Merge remote-tracking branch 'origin/main'
Harm-Nullix Jul 1, 2026
35de2cd
pnpm install runned
Harm-Nullix Jul 1, 2026
957f59c
Merge branch 'main' into v2
Harm-Nullix Jul 1, 2026
a507bf7
chore: release v3.0.0
Harm-Nullix Jul 1, 2026
a624e5a
support for Hanko V3
Harm-Nullix Jul 1, 2026
72d5859
chore: release v3.0.0
Harm-Nullix Jul 1, 2026
9dab4e1
chore: release v3.0.1
Harm-Nullix Jul 1, 2026
393aaab
chore: release v3.0.2
Harm-Nullix Jul 1, 2026
eda6d31
Merge remote-tracking branch 'origin/merge-to-hanko' into merge-to-hanko
Harm-Nullix Jul 1, 2026
11038ea
restore nuxtjs references
Harm-Nullix Jul 1, 2026
820013a
Merge branch 'v3' into merge-to-hanko
Harm-Nullix Jul 1, 2026
1bd4e49
add approved builders
Harm-Nullix Jul 1, 2026
d2bf9cc
revert pnpm workspace alltogether
Harm-Nullix Jul 1, 2026
720c026
fix pnpm lock file
Harm-Nullix Jul 1, 2026
e740bfb
ran bump of packages
Harm-Nullix Jul 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ You can also create your own middleware for full control.

### Auto-imports

`useHanko` is exposed in the Vue part of your app to allow you direct access to the Hanko API. You can access the current user and much more. **Note**: It will return `null` on the server.
`useHanko` and `$hanko` is exposed in the Vue part of your app to allow you direct access to the Hanko API. You can access the current user and much more. **Note**: It will return `null` on the server.

### Server utilities

By default you can access a verified JWT context on `event.context.hanko`. (It will be undefined if the user is not logged in.) If you want to handle this yourself you can set `augmentContext: false`.
By default, you can access a verified JWT context on `event.context.hanko`. (It will be undefined if the user is not logged in.) If you want to handle this yourself you can set `augmentContext: false`.

`verifyHankoEvent` is exposed in the Nitro part of your app to expose the underlying utility used to create `event.context.hanko` if you want to handle things manually.

Expand Down
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nuxtjs/hanko",
"version": "1.0.1",
"version": "3.0.0",
"description": "Hanko integration for Nuxt",
"keywords": [
"authentication",
Expand All @@ -15,6 +15,9 @@
"type": "git",
"url": "git+https://github.com/nuxt-modules/hanko.git"
},
"publishConfig": {
"access": "public"
},
"license": "MIT",
"type": "module",
"exports": {
Expand Down Expand Up @@ -49,11 +52,11 @@
"test:watch": "vitest watch"
},
"dependencies": {
"@nuxt/kit": "^4.0.0",
"@teamhanko/hanko-elements": "1.5.2",
"defu": "^6.1.4",
"jose": "^6.0.0",
"ufo": "^1.5.4"
"@nuxt/kit": "^4.4.8",
"@teamhanko/hanko-elements": "3.0.0",
"defu": "^6.1.7",
"jose": "^6.2.3",
"ufo": "^1.6.4"
},
"devDependencies": {
"@nuxt/eslint-config": "1.16.0",
Expand Down
2 changes: 1 addition & 1 deletion playground/pages/about.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<main>
<h1>About</h1>
<p>
This page is accesible to both logged in and logged out users. No middleware is defined for
This page is accessible to both logged in and logged out users. No middleware is defined for
this page.
</p>
</main>
Expand Down
2 changes: 1 addition & 1 deletion playground/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<main>
<h1>Home</h1>
<p>
This page is accesible to both logged in and logged out users. No middleware is defined for
This page is accessible to both logged in and logged out users. No middleware is defined for
this page. Use the navigation above to navigate to other pages.
</p>
</main>
Expand Down
9 changes: 6 additions & 3 deletions playground/pages/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ definePageMeta({
<main>
<h1>Log in</h1>
<p>
Only logged out users can see this page<pre>definePageMeta({
middleware: ['hanko-logged-out'],
})</pre>
Only logged out users can see this page
</p>
<pre><code>
definePageMeta({
middleware: ['hanko-logged-out'],
})
</code></pre>
<p v-if="$route.query.redirect">
You were redirected here from {{ $route.query.redirect }}, once you login, you'll be sent back automatically!
</p>
Expand Down
16 changes: 11 additions & 5 deletions playground/pages/protected.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@ definePageMeta({
})
const hanko = useHanko()
function logout() {
hanko!.user.logout()
hanko!.logout()
}
</script>

<template>
<div>
<h1>Protected Page</h1>
<p>
Only logged in users can see this page<pre>definePageMeta({
middleware: ['hanko-logged-in'],
})</pre>
Only logged in users can see this page
</p>
<pre><code>
definePageMeta({
middleware: ['hanko-logged-in'],
})
</code></pre>
<button @click="logout">
Log me out
Log me out by composable
</button>
<button @click="$hanko!.logout()">
Log me out by provide
</button>
</div>
</template>
13 changes: 8 additions & 5 deletions playground/pages/user.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ definePageMeta({
middleware: ['hanko-logged-in'],
})

const hanko = useHanko()
const { $hanko } = useNuxtApp()
function logout() {
hanko!.user.logout()
$hanko!.logout()
}

const result = ref()
Expand All @@ -20,10 +20,13 @@ async function tryAuthenticatedRequest() {
<main>
<h1>You are logged in!</h1>
<p>
Only logged in users can see this page<pre>definePageMeta({
middleware: ['hanko-logged-in'],
})</pre>
Only logged in users can see this page
</p>
<pre><code>
definePageMeta({
middleware: ['hanko-logged-in'],
})
</code></pre>
<button @click="logout">
Log me out
</button>
Expand Down
Loading
Loading