Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -20,7 +20,7 @@ npm i -D @sidebase/nuxt-auth

Then visit the [Quick Start documentation](https://sidebase.io/nuxt-auth/getting-started/quick-start) to setup the module for <= v0.5 - the current stable version.

Visit the [Quick Start documentation](https://sidebase.io/nuxt-auth/0.6/getting-started/quick-start) to setup the module for >= v0.6 - the "future" experimental version with support for static Nuxt 3 apps and the `local` provider.
Visit the [Quick Start documentation](https://sidebase.io/nuxt-auth/v0.6/getting-started/quick-start) to setup the module for >= v0.6 - the "future" experimental version with support for static Nuxt 3 apps and the `local` provider.

## Features

Expand Down Expand Up @@ -56,7 +56,7 @@ Features of the `authjs`-provider of `nuxt-auth` include:
- `GET /csrf`,
- `GET /providers`

You can find a feature-table of all starting with v0.6 in the [nuxt-auth "next"-version-docs](https://sidebase.io/nuxt-auth/0.6/getting-started).
You can find a feature-table of all starting with v0.6 in the [nuxt-auth "next"-version-docs](https://sidebase.io/nuxt-auth/v0.6/getting-started).

## Demo Page

Expand Down
2 changes: 1 addition & 1 deletion docs/content/1.getting-started/1.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: "Introduction to `nuxt-auth` and its features as an authentication
# Introduction

::alert{type="info"}
[Checkout the `0.6`-docs](/nuxt-auth/0.6/getting-started) if you want to get get started with the `local`-provider or have a static Nuxt application.
[Checkout the `0.6`-docs](/nuxt-auth/v0.6/getting-started) if you want to get get started with the `local`-provider or have a static Nuxt application.
::

`nuxt-auth` is an open source Nuxt module that provides authentication for non-static Nuxt 3 applications.
Expand Down
4 changes: 2 additions & 2 deletions docs/content/v0.6/1.getting-started/1.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Other libraries / modules would call these authentication-schemes, backends or m
Show me the code!

#content
Visit the [quick start](/nuxt-auth/0.6/getting-started/quick-start) page to see code examples.
Visit the [quick start](/nuxt-auth/v0.6/getting-started/quick-start) page to see code examples.

Checkout the example `nuxt-auth` app: https://nuxt-auth-example.sidebase.io/

Expand Down Expand Up @@ -77,7 +77,7 @@ In the future a separate OAuth provider for static apps may be added, read the n

We use `authjs` everywhere to mean `authjs` and `next-auth` interchangably as `next-auth` is currently transitioning to become `authjs` (branded name: `Auth.js`), see [the announcement here](https://twitter.com/balazsorban44/status/1603082914362986496).

We are following this transition and are changing code related to this as it becomes stable enough to use it. You can follow our implementation of this transition [in this issue](https://github.com/sidebase/nuxt-auth/0.6/issues/117). If you are googling anything related to this provider, we recommend that you still use the term `next-auth` as this is still the mainly used library and the stable one we mostly use under the hood. New features that are `Auth.js` only are _not_ guaranteed to work at the moment, as we still mostly rely on next-auth as a stable foundation.
We are following this transition and are changing code related to this as it becomes stable enough to use it. You can follow our implementation of this transition [in this issue](https://github.com/sidebase/nuxt-auth/v0.6/issues/117). If you are googling anything related to this provider, we recommend that you still use the term `next-auth` as this is still the mainly used library and the stable one we mostly use under the hood. New features that are `Auth.js` only are _not_ guaranteed to work at the moment, as we still mostly rely on next-auth as a stable foundation.

### `local` Remarks

Expand Down
6 changes: 3 additions & 3 deletions docs/content/v0.6/1.getting-started/2.installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ pnpm i [email protected]

You can find all available `next-auth` versions [on npm](https://www.npmjs.com/package/next-auth?activeTab=versions). You do not need to install any other peer-dependencies in order to use `nuxt-auth`.

If you are unsure which provider to choose, have a look at the [overview on the getting-started page](/nuxt-auth/0.6/getting-started#which-provider-should-i-pick).
If you are unsure which provider to choose, have a look at the [overview on the getting-started page](/nuxt-auth/v0.6/getting-started#which-provider-should-i-pick).

## Specifics: `local`-Provider

The `local` provider does not have any specific extra dependencies. However, you will need to make sure that you have a backend somewhere that provides username + password based authentication, [read more about this on the quick-start page](/nuxt-auth/0.6/getting-started/quick-start).
The `local` provider does not have any specific extra dependencies. However, you will need to make sure that you have a backend somewhere that provides username + password based authentication, [read more about this on the quick-start page](/nuxt-auth/v0.6/getting-started/quick-start).

If you are unsure which provider to choose, have a look at the [overview on the getting-started page](/nuxt-auth/0.6/getting-started#which-provider-should-i-pick).
If you are unsure which provider to choose, have a look at the [overview on the getting-started page](/nuxt-auth/v0.6/getting-started#which-provider-should-i-pick).

## Requirements

Expand Down
10 changes: 5 additions & 5 deletions docs/content/v0.6/1.getting-started/3.quick-start.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Quick Start

After [following the installation-steps](/nuxt-auth/0.6/getting-started/installation), add `@sidebase/nuxt-auth` to your `nuxt.config.ts` and specify the provider-type you want to use:
After [following the installation-steps](/nuxt-auth/v0.6/getting-started/installation), add `@sidebase/nuxt-auth` to your `nuxt.config.ts` and specify the provider-type you want to use:
::code-group
```ts [authjs]
export default defineNuxtConfig({
Expand Down Expand Up @@ -63,11 +63,11 @@ The local provider does not require any additional steps, as it relies on an alr
}
```

So when you call the `signIn` method, the endpoint `/api/auth/login` will be hit with the `username` and `password` you pass as a body-payload. You likely have to modify these parameters to fit to your backend - you can adjust these parameters in your `nuxt.config.ts` using the options [specified here](/nuxt-auth/0.6/configuration/nuxt-config).
So when you call the `signIn` method, the endpoint `/api/auth/login` will be hit with the `username` and `password` you pass as a body-payload. You likely have to modify these parameters to fit to your backend - you can adjust these parameters in your `nuxt.config.ts` using the options [specified here](/nuxt-auth/v0.6/configuration/nuxt-config).

Note: The backend can also be in the same Nuxt 3 application, e.g., have a look at this example in the `nuxt-auth` repository:
- [backend-implementation](https://github.com/sidebase/nuxt-auth/0.6/tree/main/examples/local/server/api/auth)
- [`nuxt.config.ts` matching this implementation](https://github.com/sidebase/nuxt-auth/0.6/tree/main/examples/local/nuxt.config.ts)
- [backend-implementation](https://github.com/sidebase/nuxt-auth/v0.6/tree/main/examples/local/server/api/auth)
- [`nuxt.config.ts` matching this implementation](https://github.com/sidebase/nuxt-auth/v0.6/tree/main/examples/local/nuxt.config.ts)

::alert{type="info"}
The linked example-implementation only serves as a starting-point and is not considered to be secure.
Expand Down Expand Up @@ -119,4 +119,4 @@ export default eventHandler(async (event) => {
```
::

To learn how to protect pages read [about the application-side usage](/nuxt-auth/0.6/application-side), to learn how to protect server-routes and API endpoints read [about the server-side usage](/nuxt-auth/0.6/server-side). You can also find more provider-specific information on these pages.
To learn how to protect pages read [about the application-side usage](/nuxt-auth/v0.6/application-side), to learn how to protect server-routes and API endpoints read [about the server-side usage](/nuxt-auth/v0.6/server-side). You can also find more provider-specific information on these pages.
4 changes: 2 additions & 2 deletions docs/content/v0.6/1.getting-started/4.getting-help.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ At some point, you may find that there's an issue you need some help with.

But don't worry! We're a friendly community of developers and we'd love to help. Concretely this means to:
- Checkout the docs (page that you are currently viewing),
- Search open & resolved issues and discussions: https://github.com/sidebase/nuxt-auth/0.6/issues
- Search open & resolved issues and discussions: https://github.com/sidebase/nuxt-auth/v0.6/issues
- Hop on Discord to ask us directly: https://discord.gg/VzABbVsqAc,
- Open an issue to file a bug, ask for an enhancement or get an answer to a question: https://github.com/sidebase/nuxt-auth/0.6/issues/new/choose
- Open an issue to file a bug, ask for an enhancement or get an answer to a question: https://github.com/sidebase/nuxt-auth/v0.6/issues/new/choose

We aim to follow the getting-help standards of the nuxt-project as described here and ask you to do the same when opening an issue or pinging us for help: https://nuxt.com/docs/community/getting-help#getting-help.

Expand Down
4 changes: 2 additions & 2 deletions docs/content/v0.6/2.configuration/1.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: "Overview of the configuration options of `nuxt-auth` for Vue / Nux
# Overview

Use the following places to configure how `nuxt-auth` behaves:
- `local` & `authjs`-provider: The [auth key in `nuxt.config.ts`](/nuxt-auth/0.6/configuration/nuxt-config). Use it to configure the module itself, e.g., whether global page protection is enabled
- `authjs`-provider: The [NuxtAuthHandler](/nuxt-auth/0.6/configuration/nuxt-auth-handler). Use it to configure the `authjs` authentication behavior, e.g., what authentication providers to use.
- `local` & `authjs`-provider: The [auth key in `nuxt.config.ts`](/nuxt-auth/v0.6/configuration/nuxt-config). Use it to configure the module itself, e.g., whether global page protection is enabled
- `authjs`-provider: The [NuxtAuthHandler](/nuxt-auth/v0.6/configuration/nuxt-auth-handler). Use it to configure the `authjs` authentication behavior, e.g., what authentication providers to use.

See the detailed possible configuration options on the next pages.
10 changes: 5 additions & 5 deletions docs/content/v0.6/2.configuration/2.nuxt-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ interface ModuleOptions {
* - auth.js: OAuth focused provider for non-static Nuxt 3 applications
* - local: Provider for credentials & token based backends, e.g., written by yourself or provided by something like Laraval
*
* Find more about supported providers here: https://sidebase.io/nuxt-auth/0.6/getting-started
* Find more about supported providers here: https://sidebase.io/nuxt-auth/v0.6/getting-started
*
*/
provider?: AuthProviders
Expand All @@ -67,7 +67,7 @@ interface ModuleOptions {
* If you enable this, everything is going to be protected and you can selectively disable protection for some pages by specifying `definePageMeta({ auth: false })`
* If you disable this, everything is going to be public and you can selectively enable protection for some pages by specifying `definePageMeta({ auth: true })`
*
* Read more on this topic [in the page protection docs](https://sidebase.io/nuxt-auth/0.6/application-side/protecting-pages#global-middleware).
* Read more on this topic [in the page protection docs](https://sidebase.io/nuxt-auth/v0.6/application-side/protecting-pages#global-middleware).
*
* @example true
* @example { allow404WithoutAuth: true }
Expand All @@ -86,7 +86,7 @@ type ProviderAuthjs = {
* - `authjs`: `next-auth` / `auth.js` based OAuth, Magic URL, Credential provider for non-static applications
* - `local`: Username and password provider with support for static-applications
*
* Read more here: https://sidebase.io/nuxt-auth/0.6/getting-started
* Read more here: https://sidebase.io/nuxt-auth/v0.6/getting-started
*/
type: Extract<SupportedAuthProviders, 'authjs'>
/**
Expand Down Expand Up @@ -122,7 +122,7 @@ type ProviderLocal = {
* - `authjs`: `next-auth` / `auth.js` based OAuth, Magic URL, Credential provider for non-static applications
* - `local`: Username and password provider with support for static-applications
*
* Read more here: https://sidebase.io/nuxt-auth/0.6/getting-started
* Read more here: https://sidebase.io/nuxt-auth/v0.6/getting-started
*/
type: Extract<SupportedAuthProviders, 'local'>
/**
Expand Down Expand Up @@ -302,7 +302,7 @@ For the demo-app at https://nuxt-auth-example.sidebase.io we set the `origin` to

This is what tells the module where you added the authentication endpoints. By default this documentation recommends to use `/api/auth`, so that means that the module expects that all requests to `/api/auth/*` will be handled by the `NuxtAuthHandler`.

To statify this, you need to create a [catch-all server-route](https://nuxt.com/docs/guide/directory-structure/pages/#catch-all-route) at that location by creating a file `~/server/api/auth/[...].ts` that exports the `NuxtAuthHandler`, see more on this in the [Quick Start](/nuxt-auth/0.6/next/getting-started/quick-start) or in the [`NuxtAuthHandler` documentation](/nuxt-auth/0.6/next/configuration/nuxt-auth-handler)
To statify this, you need to create a [catch-all server-route](https://nuxt.com/docs/guide/directory-structure/pages/#catch-all-route) at that location by creating a file `~/server/api/auth/[...].ts` that exports the `NuxtAuthHandler`, see more on this in the [Quick Start](/nuxt-auth/v0.6/next/getting-started/quick-start) or in the [`NuxtAuthHandler` documentation](/nuxt-auth/v0.6/next/configuration/nuxt-auth-handler)

If you want to have the authentication at another location, you should change the path, e.g., when setting the path-part of the `baseURL` to:
- `path: "/api/_auth"` -> you need to add the authentication catch-all endpoints into `~/server/api/_auth/[...].ts` and this is where `nuxt-auth` will look
Expand Down
6 changes: 3 additions & 3 deletions docs/content/v0.6/2.configuration/3.nuxt-auth-handler.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This page is only relevant to you, if you are using the `authjs`-provider.

# NuxtAuthHandler

After following the [quick-start setup](/nuxt-auth/0.6/getting-started/quick-start) and then optionally diving even deeper into the [`nuxt-auth` config inside your `nuxt.config.ts`](/nuxt-auth/0.6/configuration/nuxt-config) you can begin defining providers and other options inside your `NuxtAuthHandler`.
After following the [quick-start setup](/nuxt-auth/v0.6/getting-started/quick-start) and then optionally diving even deeper into the [`nuxt-auth` config inside your `nuxt.config.ts`](/nuxt-auth/v0.6/configuration/nuxt-config) you can begin defining providers and other options inside your `NuxtAuthHandler`.

For development, using the quick-start setup will already bring you quite far. For a production deployment, you will have to additionally:
- set the `origin` by:
Expand All @@ -18,7 +18,7 @@ For development, using the quick-start setup will already bring you quite far. F

## Creating the `NuxtAuthHandler`

In order to create your own `NuxtAuthHandler`, create the file `~/server/api/auth/[...].ts`. This file will automatically set up the authentication API that responds to all requests going to `https://localhost/api/auth/*`. If you wish you can also use a custom file location and api path, however this change will need to be reflected in the [basePath](/nuxt-auth/0.6/configuration/nuxt-config#basepath), which is configured in the [nuxt.config.ts](/nuxt-auth/0.6/configuration/nuxt-config).
In order to create your own `NuxtAuthHandler`, create the file `~/server/api/auth/[...].ts`. This file will automatically set up the authentication API that responds to all requests going to `https://localhost/api/auth/*`. If you wish you can also use a custom file location and api path, however this change will need to be reflected in the [basePath](/nuxt-auth/v0.6/configuration/nuxt-config#basepath), which is configured in the [nuxt.config.ts](/nuxt-auth/v0.6/configuration/nuxt-config).

::alert{type="warning"}
The filename must be `[...].ts` - this is a so-called "catch-all" route, read more [in the Nuxt catch-all docs](https://nuxt.com/docs/guide/directory-structure/server#catch-all-route).
Expand Down Expand Up @@ -136,4 +136,4 @@ export default NuxtAuthHandler({

## Further Examples

Checkout the [provider recipes](/nuxt-auth/0.6/recipes) to see different examples of provider configurations, e.g., for Strapi or Directus.
Checkout the [provider recipes](/nuxt-auth/v0.6/recipes) to see different examples of provider configurations, e.g., for Strapi or Directus.
8 changes: 4 additions & 4 deletions docs/content/v0.6/3.application-side/1.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ description: "Application-side usage of `nuxt-auth` for Vue / Nuxt 3 apps."

On the application-side this module offers:
::list{type="success"}
- [`useAuth` composable for session access and management](/nuxt-auth/0.6/application-side/session-access-and-management)
- [Creation of custom sign-in pages](/nuxt-auth/0.6/application-side/custom-sign-in-page)
- [Middleware to protect your application on the application side](/nuxt-auth/0.6/application-side/protecting-pages)
- [`useAuth` composable for session access and management](/nuxt-auth/v0.6/application-side/session-access-and-management)
- [Creation of custom sign-in pages](/nuxt-auth/v0.6/application-side/custom-sign-in-page)
- [Middleware to protect your application on the application side](/nuxt-auth/v0.6/application-side/protecting-pages)
::

Application-side usage refers to any code like pages, components or composables that are part of the universal server- and client-side rendering of Nuxt, see more in the [glossary](/nuxt-auth/0.6/resources/glossary).
Application-side usage refers to any code like pages, components or composables that are part of the universal server- and client-side rendering of Nuxt, see more in the [glossary](/nuxt-auth/v0.6/resources/glossary).
Loading