Skip to content

Commit

Permalink
added external backend section back to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zoey-kaiser committed Dec 19, 2024
1 parent 707bcfd commit d230df1
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/guide/local/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,31 @@ export default defineNuxtConfig({
You cannot disable the `getSession` endpoint, as NuxtAuth internally uses it to determine the authentication status.
:::

### Using an external backend

You can also set your endpoints to query an external backend:

```ts
export default defineNuxtConfig({
// ...Previous configuration
runtimeConfig: {
baseURL: 'https://example-api.com'
},
auth: {
originEnvKey: 'NUXT_BASE_URL',
provider: {
type: 'local',
endpoints: {
signIn: { path: '/auth/login', method: 'post' },
signOut: { path: '/auth/logout', method: 'post' },
signUp: { path: '/auth/register', method: 'post' },
getSession: { path: '/user/session', method: 'get' },
}
}
}
})
```

## Token

The `local` and `refresh` providers are both based on exchanging access tokens with your backend. NuxtAuth expects an access token to be provided by the `signIn` endpoint, which will then be saved into the session to authenticate further requests to e.g. `getSession`.
Expand Down

0 comments on commit d230df1

Please sign in to comment.