@unkey/nuxt module.
Install
- bun
- pnpm
- yarn
- npm
Configuration
@unkey/nuxt just requires your root key. Create an .env file in your project and add the following:
NUXT_UNKEY_TOKEN environment variable.
From this point onward, @unkey/nuxt will automatically:
- verify any API requests with an
Authorization: Bearer xxxheader. - register a
useUnkey()helper that allows access to an automatically configured unkey instance.
Usage
Automatic verification
You can access the automatically-verifiedunkey context on the server with event.context.unkey in your server routes or useRequestEvent().context.unkey in the Vue part of your app.
For example:
- ~/server/api/test.ts
- ~/app.vue
Unkey helper
For more about how to use the configured helper provided byuseUnkey(), you can see the API docs for the TypeScript client.
For example: