You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that there's way more options inside the `nextAuth.options` object, see [here](https://next-auth.js.org/configuration/options#options) for all available options.
E.g., here to redirect the user away from the already loaded, protected, page after signout (else, you will have to handle the redirect yourself).
346
351
352
+
##### Custom sign in page
353
+
354
+
To create your custom sign-in page you can use `signIn` to directly start a provider-flow once the user selected it, e.g., by clicking on a button on your custom sign-in page. Here is a very simple sign-in page that either directly starts a github-oauth sign in flow or directly signs in the user via the credentials flow:
355
+
```vue
356
+
<template>
357
+
<div>
358
+
<p>Sign In Options</p>
359
+
<button @click="signIn('github')">Github</button>
360
+
<!-- NOTE: Here we hard-coded username and password, on your own page this should probably be connected to two inputs for username + password -->
361
+
<button @click="signIn('credentials', { username: 'test', password: 'hunter2' })">Username and Password</button>
Note: In the above example `username` and `password` are hard-coded. In your own custom page, these two fields should probably come from inputs on your page.
371
+
372
+
If you want to create a custom sign-in page that dynamically offers sign-in options based on your configured providers, you can call `getProviders()` first and then iterate over the supported providers to generate your sign in page.
373
+
347
374
#### Middleware
348
375
349
376
You can use this library to define application middleware. This library supports all of [Nuxt's supported approaches](https://v3.nuxtjs.org/guide/directory-structure/middleware#middleware-directory), read on to learn how.
@@ -542,6 +569,24 @@ All endpoints that NextAuth.js supports are also supported by `nuxt-auth`:
542
569
543
570
You can directly interact with them if you wish to, it's probably a better idea to use `useSession` where possible though. [See the full rest API documentation of NextAuth.js here](https://next-auth.js.org/getting-started/rest-api).
544
571
572
+
#### Security
573
+
574
+
This section mostly contains a list of possible security problems. Note that the below flaws exist with many libraries and frameworks we use in our day-to-day when building and working with APIs. Even your vanilla Nuxt app already posesses some of these shortcoming. Missing in the below list are estimates of how likely it is that one of the list-items may occur and what impact it will have on your app. This is because that heavily depends on:
575
+
- your app: Are you building a fun project? A proof of concept? The next fort-nox money management app?
576
+
- your environment: Building a freely available app for fun? Have authentication in front of your app and trust all users that successfully authenticated? Superb! Don't trust anyone? Then please be extra-careful when using this library and when building you backend in general
577
+
578
+
Without further ado, here's some attack cases you can consider and take action against. Neither the attack vectors, the problems or the mitigations are exhaustive:
579
+
1. sending arbitrary data: Denial-of-Service by server-ressource exhaustion (bandwidth, cpu, memory), arbitrary code execution (if you parse the data), ...
580
+
2. creation arbitrarily many sessions: Denial-of-Service by server-ressource exhaustion (bandwidth, cpu, memory)
581
+
3. guessing correct session ids: session data can leak
582
+
4. stealing session id(s) of client(s): session data can leak
583
+
584
+
Read up how to mitigate these and more issues if you see fit. Checkout the [`nuxt-security`](https://github.com/Baroshem/nuxt-security) module that may help with some of these.
585
+
586
+
##### Disclosure
587
+
588
+
A last reminder: This library was not written by crypto- or security-experts. Please proceed at your own risk, inspect the code if you want to and open issues / pull requests where you see room for improvement. If you want to file a security-concern privately, please send an email to `[email protected]` with the subject saying "SECURITY nuxt-auth" and we'll look into your request ASAP.
589
+
545
590
#### Glossary
546
591
547
592
There are some terms we use in this documentation that may not immeadiatly be known to every reader. Here is an explanation for some of them:
0 commit comments