Compare commits
127 Commits
@nhost/cor
...
@nhost/str
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7692abf98c | ||
|
|
4e0aafbf08 | ||
|
|
5f18361d4a | ||
|
|
09fe573bff | ||
|
|
b7396c3b02 | ||
|
|
aa177677b5 | ||
|
|
c922de7b0c | ||
|
|
38526d7ef2 | ||
|
|
057c8be55a | ||
|
|
4783657986 | ||
|
|
e3606c091f | ||
|
|
d5489b71ec | ||
|
|
a6bc3091a2 | ||
|
|
01a086cd05 | ||
|
|
a8cc2e0c9b | ||
|
|
11f0a1493d | ||
|
|
8eafa19810 | ||
|
|
1e31a9567d | ||
|
|
c6120bfca1 | ||
|
|
4c37cc5bc2 | ||
|
|
66ef8f91a3 | ||
|
|
3f135abed9 | ||
|
|
9f127f3333 | ||
|
|
f9b164baa3 | ||
|
|
73804c8450 | ||
|
|
537259e00b | ||
|
|
94d7703f9b | ||
|
|
c24207eeea | ||
|
|
54057ffe8a | ||
|
|
0e9052e810 | ||
|
|
3a209a8ee3 | ||
|
|
f26d38a0f1 | ||
|
|
0e06259e24 | ||
|
|
ce7d81c6d3 | ||
|
|
3779772c99 | ||
|
|
c657cb85cf | ||
|
|
46dfa9634c | ||
|
|
13f5531b7e | ||
|
|
0ecff620fb | ||
|
|
0470e65a38 | ||
|
|
f031cf9463 | ||
|
|
9f81ba9713 | ||
|
|
2f815e5eb6 | ||
|
|
2cabd2d29a | ||
|
|
d4ee6cc756 | ||
|
|
8208b1c385 | ||
|
|
4c6c094f71 | ||
|
|
3dadc7eab9 | ||
|
|
784041020b | ||
|
|
74758f2c36 | ||
|
|
ea34a3856b | ||
|
|
c9175b76d3 | ||
|
|
1c82522163 | ||
|
|
5794357374 | ||
|
|
3edf41f989 | ||
|
|
44f069a253 | ||
|
|
cb0988cb87 | ||
|
|
27752ca8a7 | ||
|
|
855181abbc | ||
|
|
bc0515bd59 | ||
|
|
271c401b1a | ||
|
|
cbed7cdc72 | ||
|
|
fca620f050 | ||
|
|
5200a4f272 | ||
|
|
19458cf076 | ||
|
|
1a94359a81 | ||
|
|
96001f683a | ||
|
|
dd08453fb5 | ||
|
|
739a3c4563 | ||
|
|
20f3eb9086 | ||
|
|
7b5f8647fb | ||
|
|
486ddec751 | ||
|
|
6475047158 | ||
|
|
14b26bdbc7 | ||
|
|
8e4d790b04 | ||
|
|
d814c7b46b | ||
|
|
5baeddba0b | ||
|
|
0262723329 | ||
|
|
1cf8a58d2c | ||
|
|
b9a19d8251 | ||
|
|
465d248456 | ||
|
|
9e4861f2bb | ||
|
|
4ca738ba56 | ||
|
|
be27ed73e1 | ||
|
|
f4d81d33b9 | ||
|
|
730c7d7b28 | ||
|
|
38de442a7f | ||
|
|
22b8f02504 | ||
|
|
24825adb08 | ||
|
|
96e59f0251 | ||
|
|
9e43c320b9 | ||
|
|
f199ed5474 | ||
|
|
2f00d7f309 | ||
|
|
d35dfb1aa0 | ||
|
|
93f1d1944c | ||
|
|
efd3904966 | ||
|
|
133e682e91 | ||
|
|
72eebe538e | ||
|
|
af313212f7 | ||
|
|
06b29f14fc | ||
|
|
4b960227cf | ||
|
|
a9e2db678d | ||
|
|
4d0738d51c | ||
|
|
1a8160632e | ||
|
|
084ea77355 | ||
|
|
19e5abb4a9 | ||
|
|
fe6514fa14 | ||
|
|
92e9659cc7 | ||
|
|
d5a2a259ce | ||
|
|
6929c7f423 | ||
|
|
5e5a9d6efa | ||
|
|
a365cadbd7 | ||
|
|
8221664f61 | ||
|
|
9396bdbbe3 | ||
|
|
63fd6abd54 | ||
|
|
4e30b4ee21 | ||
|
|
b07a61b8e4 | ||
|
|
f52336f698 | ||
|
|
2d6e95b8b5 | ||
|
|
648c880445 | ||
|
|
c286a0bbb1 | ||
|
|
745d9a958d | ||
|
|
8c12b4117b | ||
|
|
afcced2417 | ||
|
|
88fa68e74c | ||
|
|
47b4a3ecf1 | ||
|
|
9095a0f6ae |
13
.github/CODEOWNERS
vendored
13
.github/CODEOWNERS
vendored
@@ -1,8 +1,13 @@
|
|||||||
# Documentation
|
# Documentation
|
||||||
# https://help.github.com/en/articles/about-code-owners
|
# https://help.github.com/en/articles/about-code-owners
|
||||||
|
|
||||||
/packages @plmercereau
|
/packages @plmercereau @szilarddoro
|
||||||
/packages/docgen @szilarddoro
|
/packages/docgen @szilarddoro
|
||||||
/.github/workflows @plmercereau
|
/packages/stripe-graphql-js @elitan
|
||||||
/docs/ @guicurcio
|
/.github @plmercereau
|
||||||
/examples/ @plmercereau @guicurcio @FuzzyReason
|
/docs/ @guicurcio @elitan
|
||||||
|
/config/ @plmercereau @szilarddoro
|
||||||
|
/examples/ @plmercereau
|
||||||
|
/examples/codegen-react-apollo @elitan @plmercereau
|
||||||
|
/examples/codegen-react-query @elitan @plmercereau
|
||||||
|
/examples/react-apollo-crm @elitan @plmercereau
|
||||||
|
|||||||
45
README.md
45
README.md
@@ -219,6 +219,13 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
</a>
|
</a>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
<td align="center">
|
||||||
|
<a href="https://github.com/ejkkan">
|
||||||
|
<img src="https://avatars.githubusercontent.com/u/32518962?v=4" width="100;" alt="ejkkan"/>
|
||||||
|
<br />
|
||||||
|
<sub><b>Erik Magnusson</b></sub>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/macmac49">
|
<a href="https://github.com/macmac49">
|
||||||
<img src="https://avatars.githubusercontent.com/u/831190?v=4" width="100;" alt="macmac49"/>
|
<img src="https://avatars.githubusercontent.com/u/831190?v=4" width="100;" alt="macmac49"/>
|
||||||
@@ -253,15 +260,15 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<br />
|
<br />
|
||||||
<sub><b>David Barroso</b></sub>
|
<sub><b>David Barroso</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td></tr>
|
||||||
|
<tr>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/hajek-raven">
|
<a href="https://github.com/hajek-raven">
|
||||||
<img src="https://avatars.githubusercontent.com/u/7288737?v=4" width="100;" alt="hajek-raven"/>
|
<img src="https://avatars.githubusercontent.com/u/7288737?v=4" width="100;" alt="hajek-raven"/>
|
||||||
<br />
|
<br />
|
||||||
<sub><b>Filip Hájek</b></sub>
|
<sub><b>Filip Hájek</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td></tr>
|
</td>
|
||||||
<tr>
|
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/MelodicCrypter">
|
<a href="https://github.com/MelodicCrypter">
|
||||||
<img src="https://avatars.githubusercontent.com/u/18341500?v=4" width="100;" alt="MelodicCrypter"/>
|
<img src="https://avatars.githubusercontent.com/u/18341500?v=4" width="100;" alt="MelodicCrypter"/>
|
||||||
@@ -296,15 +303,15 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<br />
|
<br />
|
||||||
<sub><b>Nicolas Bourdin</b></sub>
|
<sub><b>Nicolas Bourdin</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td></tr>
|
||||||
|
<tr>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/Savinvadim1312">
|
<a href="https://github.com/Savinvadim1312">
|
||||||
<img src="https://avatars.githubusercontent.com/u/16936043?v=4" width="100;" alt="Savinvadim1312"/>
|
<img src="https://avatars.githubusercontent.com/u/16936043?v=4" width="100;" alt="Savinvadim1312"/>
|
||||||
<br />
|
<br />
|
||||||
<sub><b>Savin Vadim</b></sub>
|
<sub><b>Savin Vadim</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td></tr>
|
</td>
|
||||||
<tr>
|
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/Svarto">
|
<a href="https://github.com/Svarto">
|
||||||
<img src="https://avatars.githubusercontent.com/u/24279217?v=4" width="100;" alt="Svarto"/>
|
<img src="https://avatars.githubusercontent.com/u/24279217?v=4" width="100;" alt="Svarto"/>
|
||||||
@@ -339,15 +346,15 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<br />
|
<br />
|
||||||
<sub><b>Animesh Pathak</b></sub>
|
<sub><b>Animesh Pathak</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td></tr>
|
||||||
|
<tr>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/rustyb">
|
<a href="https://github.com/rustyb">
|
||||||
<img src="https://avatars.githubusercontent.com/u/53086?v=4" width="100;" alt="rustyb"/>
|
<img src="https://avatars.githubusercontent.com/u/53086?v=4" width="100;" alt="rustyb"/>
|
||||||
<br />
|
<br />
|
||||||
<sub><b>Colin Broderick</b></sub>
|
<sub><b>Colin Broderick</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td></tr>
|
</td>
|
||||||
<tr>
|
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/dminkovsky">
|
<a href="https://github.com/dminkovsky">
|
||||||
<img src="https://avatars.githubusercontent.com/u/218725?v=4" width="100;" alt="dminkovsky"/>
|
<img src="https://avatars.githubusercontent.com/u/218725?v=4" width="100;" alt="dminkovsky"/>
|
||||||
@@ -382,15 +389,15 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<br />
|
<br />
|
||||||
<sub><b>Hoang Do</b></sub>
|
<sub><b>Hoang Do</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td></tr>
|
||||||
|
<tr>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/eltociear">
|
<a href="https://github.com/eltociear">
|
||||||
<img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="100;" alt="eltociear"/>
|
<img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="100;" alt="eltociear"/>
|
||||||
<br />
|
<br />
|
||||||
<sub><b>Ikko Ashimine</b></sub>
|
<sub><b>Ikko Ashimine</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td></tr>
|
</td>
|
||||||
<tr>
|
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/jladuval">
|
<a href="https://github.com/jladuval">
|
||||||
<img src="https://avatars.githubusercontent.com/u/1935359?v=4" width="100;" alt="jladuval"/>
|
<img src="https://avatars.githubusercontent.com/u/1935359?v=4" width="100;" alt="jladuval"/>
|
||||||
@@ -398,13 +405,6 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<sub><b>Jacob Duval</b></sub>
|
<sub><b>Jacob Duval</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td align="center">
|
|
||||||
<a href="https://github.com/kylehayes">
|
|
||||||
<img src="https://avatars.githubusercontent.com/u/509932?v=4" width="100;" alt="kylehayes"/>
|
|
||||||
<br />
|
|
||||||
<sub><b>Kyle Hayes</b></sub>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/leothorp">
|
<a href="https://github.com/leothorp">
|
||||||
<img src="https://avatars.githubusercontent.com/u/12928449?v=4" width="100;" alt="leothorp"/>
|
<img src="https://avatars.githubusercontent.com/u/12928449?v=4" width="100;" alt="leothorp"/>
|
||||||
@@ -448,6 +448,13 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<sub><b>Quentin Decré</b></sub>
|
<sub><b>Quentin Decré</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<a href="https://github.com/altschuler">
|
||||||
|
<img src="https://avatars.githubusercontent.com/u/956928?v=4" width="100;" alt="altschuler"/>
|
||||||
|
<br />
|
||||||
|
<sub><b>Simon Altschuler</b></sub>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/atapas">
|
<a href="https://github.com/atapas">
|
||||||
<img src="https://avatars.githubusercontent.com/u/3633137?v=4" width="100;" alt="atapas"/>
|
<img src="https://avatars.githubusercontent.com/u/3633137?v=4" width="100;" alt="atapas"/>
|
||||||
|
|||||||
@@ -12,11 +12,15 @@ Nhost Authentication lets you authenticate users using different sign-in methods
|
|||||||
- [Email and Password](/platform/authentication/sign-in-with-email-and-password)
|
- [Email and Password](/platform/authentication/sign-in-with-email-and-password)
|
||||||
- [Magic Link](/platform/authentication/sign-in-with-magic-link)
|
- [Magic Link](/platform/authentication/sign-in-with-magic-link)
|
||||||
- [Phone Number (SMS)](/platform/authentication/sign-in-with-phone-number-sms)
|
- [Phone Number (SMS)](/platform/authentication/sign-in-with-phone-number-sms)
|
||||||
- [Google](/platform/authentication/sign-in-with-google)
|
- [Security Keys (WebAuthn)](/platform/authentication/sign-in-with-phone-number-sms)
|
||||||
|
- [Apple](/platform/authentication/sign-in-with-apple)
|
||||||
|
- [Discord](/platform/authentication/sign-in-with-discord)
|
||||||
- [Facebook](/platform/authentication/sign-in-with-facebook)
|
- [Facebook](/platform/authentication/sign-in-with-facebook)
|
||||||
- [GitHub](/platform/authentication/sign-in-with-github)
|
- [GitHub](/platform/authentication/sign-in-with-github)
|
||||||
|
- [Google](/platform/authentication/sign-in-with-google)
|
||||||
- [LinkedIn](/platform/authentication/sign-in-with-linkedin)
|
- [LinkedIn](/platform/authentication/sign-in-with-linkedin)
|
||||||
- [Spotify](/platform/authentication/sign-in-with-spotify)
|
- [Spotify](/platform/authentication/sign-in-with-spotify)
|
||||||
|
- [Twitch](/platform/authentication/sign-in-with-twitch)
|
||||||
|
|
||||||
## How it works
|
## How it works
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,107 @@
|
|||||||
|
---
|
||||||
|
title: Sign In with Security Keys
|
||||||
|
sidebar_label: Security Keys
|
||||||
|
slug: /platform/authentication/sign-in-with-security-keys
|
||||||
|
---
|
||||||
|
|
||||||
|
Follow this guide to sign in users with security keys and the WebAuthn API.
|
||||||
|
|
||||||
|
Examples of security keys:
|
||||||
|
|
||||||
|
- [Windows Hello](https://support.microsoft.com/en-us/windows/learn-about-windows-hello-and-set-it-up-dae28983-8242-bb2a-d3d1-87c9d265a5f0)
|
||||||
|
- [Apple Touch ID](https://support.apple.com/en-us/HT201371)
|
||||||
|
- [Apple Face ID](https://support.apple.com/en-us/HT208109)
|
||||||
|
- [Yubico security keys](https://www.yubico.com/)
|
||||||
|
- Android Fingerprint sensors
|
||||||
|
|
||||||
|
You can read more about this feature in our [blog post](https://nhost.io/blog/webauthn-sign-in-method)
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
Enable the Security Key sign-in method in the Nhost dashboard under **Users** -> **Authentication Settings** -> **Security Keys**.
|
||||||
|
|
||||||
|
You need to make sure you also set a valid client URL under **Users** -> **Authentication Settings** -> **Client URL**.
|
||||||
|
|
||||||
|
<video width="99%" autoPlay muted loop controls="true" style={{ marginBottom: '15px' }}>
|
||||||
|
<source src="/videos/enable-security-keys-sign-in.mp4" type="video/mp4" />
|
||||||
|
</video>
|
||||||
|
|
||||||
|
## Sign Up
|
||||||
|
|
||||||
|
Signing up with a security key uses the same method as signing up with an email and a password. Instead of a `password` parameter, you need to set the `securityKey` parameter to `true`:
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
const { error, session } = await nhost.auth.signUp({
|
||||||
|
email: 'joe@example.com',
|
||||||
|
securityKey: true
|
||||||
|
})
|
||||||
|
if (error) {
|
||||||
|
// Something unexpected happened, for instance, the user canceled their registration
|
||||||
|
console.log(error)
|
||||||
|
} else if (session) {
|
||||||
|
// Sign up is complete!
|
||||||
|
console.log(session.user)
|
||||||
|
} else {
|
||||||
|
console.log(
|
||||||
|
'You need to verify your email address by clicking the link in the email we sent you.'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sign In
|
||||||
|
|
||||||
|
Once a user added a security key, they can use it to sign in:
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
const { error, session } = await nhost.auth.signIn({
|
||||||
|
email,
|
||||||
|
securityKey: true
|
||||||
|
})
|
||||||
|
if (session) {
|
||||||
|
// User is signed in
|
||||||
|
} else {
|
||||||
|
// Something unexpected happened
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Add a Security Key
|
||||||
|
|
||||||
|
Any signed-in user with a valid email can add a security key when the feature is enabled. For instance, someone who signed up with an email and a password can add a security key and thus use it for their later sign-in!
|
||||||
|
|
||||||
|
Users can use multiple devices to sign in to their account. They can add as many security keys as they like.
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
const { key, error } = await nhost.auth.addSecurityKey()
|
||||||
|
if (key) {
|
||||||
|
// Successfully added a new security key
|
||||||
|
console.log(key.id)
|
||||||
|
} else {
|
||||||
|
// Somethine unexpected happened
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
A nickname can be added for each security key to make them easy to identify:
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
await nhost.auth.addSecurityKey('my macbook')
|
||||||
|
```
|
||||||
|
|
||||||
|
## List or Remove Security Keys
|
||||||
|
|
||||||
|
To list and to remove security keys can be achieved over GraphQL after setting the correct Hasura permissions to the `auth.security_keys` table:
|
||||||
|
|
||||||
|
```graphql
|
||||||
|
query securityKeys($userId: uuid!) {
|
||||||
|
authUserSecurityKeys(where: { userId: { _eq: $userId } }) {
|
||||||
|
id
|
||||||
|
nickname
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mutation removeSecurityKey($id: uuid!) {
|
||||||
|
deleteAuthUserSecurityKey(id: $id) {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
@@ -9,49 +9,12 @@ Nhost Authentication support the following sign-in methods:
|
|||||||
- [Email and Password](/platform/authentication/sign-in-with-email-and-password)
|
- [Email and Password](/platform/authentication/sign-in-with-email-and-password)
|
||||||
- [Magic Link](/platform/authentication/sign-in-with-magic-link)
|
- [Magic Link](/platform/authentication/sign-in-with-magic-link)
|
||||||
- [Phone Number (SMS)](/platform/authentication/sign-in-with-phone-number-sms)
|
- [Phone Number (SMS)](/platform/authentication/sign-in-with-phone-number-sms)
|
||||||
- [Google](/platform/authentication/sign-in-with-google)
|
- [Security Keys (WebAuthn)](/platform/authentication/sign-in-with-phone-number-sms)
|
||||||
|
- [Apple](/platform/authentication/sign-in-with-apple)
|
||||||
|
- [Discord](/platform/authentication/sign-in-with-discord)
|
||||||
- [Facebook](/platform/authentication/sign-in-with-facebook)
|
- [Facebook](/platform/authentication/sign-in-with-facebook)
|
||||||
- [GitHub](/platform/authentication/sign-in-with-github)
|
- [GitHub](/platform/authentication/sign-in-with-github)
|
||||||
|
- [Google](/platform/authentication/sign-in-with-google)
|
||||||
- [LinkedIn](/platform/authentication/sign-in-with-linkedin)
|
- [LinkedIn](/platform/authentication/sign-in-with-linkedin)
|
||||||
- [Spotify](/platform/authentication/sign-in-with-spotify)
|
- [Spotify](/platform/authentication/sign-in-with-spotify)
|
||||||
|
- [Twitch](/platform/authentication/sign-in-with-twitch)
|
||||||
## Enabling Social Sign-In Provider
|
|
||||||
|
|
||||||
To start with social sign-in, select your project in Nhost Dashboard and go to **Users** → **Authentication Settings**.
|
|
||||||
|
|
||||||
You need to set the Client ID and Client Secret for each provider that you want to enable.
|
|
||||||
|
|
||||||
## Implementing sign-in experience
|
|
||||||
|
|
||||||
Use the [Nhost JavaScript SDK](/reference/javascript) and the `signIn()` method to implement social sign-in for your project.
|
|
||||||
|
|
||||||
Here's an example of how to implement sign-in with GitHub:
|
|
||||||
|
|
||||||
```js
|
|
||||||
nhost.auth.signIn({
|
|
||||||
provider: 'github'
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
Users are redirected to your Nhost project's **client URL** by default. By default, your Nhost project's client URL is set to `http://localhost:3000`. You can change the value of your client URL in the Nhost console by going to **Users** → **Authentication Settings** → **Client URL**.
|
|
||||||
|
|
||||||
Here is an example of how to redirect to another host or path:
|
|
||||||
|
|
||||||
```js
|
|
||||||
nhost.auth.signIn({
|
|
||||||
provider: '<provider>'
|
|
||||||
options: {
|
|
||||||
redirectTo: "<host>/<slug>" // Example: "https://example.com/dashboard"
|
|
||||||
},
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
## Provider OAuth scopes
|
|
||||||
|
|
||||||
Scopes are a mechanism in OAuth to allow or limit an application's access to a user's account.
|
|
||||||
|
|
||||||
By default, Nhost sets the scope to get the name, email, and avatar URL for each user. Editing scope is not currently supported.
|
|
||||||
|
|
||||||
## Provider OAuth Tokens
|
|
||||||
|
|
||||||
Nhost saves both access and refresh tokens for each user and provider in the `auth.user_providers` table. These tokens can be used to interact with the provider if needed.
|
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
---
|
||||||
|
title: Social Providers Configuration
|
||||||
|
sidebar_label: Social Providers Configuration
|
||||||
|
sidebar_position: 10
|
||||||
|
---
|
||||||
|
|
||||||
|
## Enabling Social Sign-In Provider
|
||||||
|
|
||||||
|
To start with social sign-in, select your project in Nhost Dashboard and go to **Users** → **Authentication Settings**.
|
||||||
|
|
||||||
|
You need to set the Client ID and Client Secret for each provider that you want to enable.
|
||||||
|
|
||||||
|
## Implementing sign-in experience
|
||||||
|
|
||||||
|
Use the [Nhost JavaScript SDK](/reference/javascript) and the `signIn()` method to implement social sign-in for your project.
|
||||||
|
|
||||||
|
Here's an example of how to implement sign-in with GitHub:
|
||||||
|
|
||||||
|
```js
|
||||||
|
nhost.auth.signIn({
|
||||||
|
provider: 'github'
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
Users are redirected to your Nhost project's **client URL** by default. By default, your Nhost project's client URL is set to `http://localhost:3000`. You can change the value of your client URL in the Nhost console by going to **Users** → **Authentication Settings** → **Client URL**.
|
||||||
|
|
||||||
|
Here is an example of how to redirect to another host or path:
|
||||||
|
|
||||||
|
```js
|
||||||
|
nhost.auth.signIn({
|
||||||
|
provider: '<provider>'
|
||||||
|
options: {
|
||||||
|
redirectTo: "<host>/<slug>" // Example: "https://example.com/dashboard"
|
||||||
|
},
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
## Provider OAuth scopes
|
||||||
|
|
||||||
|
Scopes are a mechanism in OAuth to allow or limit an application's access to a user's account.
|
||||||
|
|
||||||
|
By default, Nhost sets the scope to get the name, email, and avatar URL for each user. Editing scope is not currently supported.
|
||||||
|
|
||||||
|
## Provider OAuth Tokens
|
||||||
|
|
||||||
|
Nhost saves both access and refresh tokens for each user and provider in the `auth.user_providers` table. These tokens can be used to interact with the provider if needed.
|
||||||
@@ -39,7 +39,7 @@ query {
|
|||||||
|
|
||||||
Users should be created using the sign-up or sign-in flows as described under [sign-in methods](/platform/authentication/sign-in-methods).
|
Users should be created using the sign-up or sign-in flows as described under [sign-in methods](/platform/authentication/sign-in-methods).
|
||||||
|
|
||||||
- **Never** create users directly via GraphQL or database.
|
- **Never** create users directly via GraphQL or database, unless you [import users](#import-users) from an external system.
|
||||||
- **Never** modify the `auth.users` table.
|
- **Never** modify the `auth.users` table.
|
||||||
- **Never** modify the GraphQL root queries or fields for any of the tables in the `auth` schema.
|
- **Never** modify the GraphQL root queries or fields for any of the tables in the `auth` schema.
|
||||||
|
|
||||||
@@ -136,3 +136,31 @@ await nhost.auth.signUp({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Import Users
|
||||||
|
|
||||||
|
If you have users in a different system, you can import them into Nhost. When importing users you should insert the users directly into the database instead of using the authentication endpoints (`/signup/email-password`).
|
||||||
|
|
||||||
|
It's possible to insert users via GraphQL or SQL.
|
||||||
|
|
||||||
|
### GraphQL
|
||||||
|
|
||||||
|
Make a GraphQL request to insert a user like this:
|
||||||
|
|
||||||
|
```graphql
|
||||||
|
mutation insertUser($user: users_insert_input!) {
|
||||||
|
insertUser(object: $user) {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### SQL
|
||||||
|
|
||||||
|
Connect directly to the database and insert a user like this:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
INSERT INTO auth.users (id, email, display_name, password_hash, ..) VALUES ('<user-id>', '<email>', '<display-name>', '<password-hash>', ..);
|
||||||
|
```
|
||||||
|
|
||||||
|
User passwords are hashed using [bcrypt](https://en.wikipedia.org/wiki/Bcrypt) in Nhost.
|
||||||
|
|||||||
@@ -6,13 +6,17 @@ image: /img/og/platform/event-triggers.png
|
|||||||
|
|
||||||
Event Triggers enable you to invoke webhooks when a database event happens. Event Triggers are typically used to do post-processing tasks, using custom backend code, based on database events.
|
Event Triggers enable you to invoke webhooks when a database event happens. Event Triggers are typically used to do post-processing tasks, using custom backend code, based on database events.
|
||||||
|
|
||||||
Event Triggers are associated with a specific table in the database the following event types are available:
|
Event Triggers are associated with a specific table in the database and the following event types are available:
|
||||||
|
|
||||||
- **INSERT** - A row is inserted into a table
|
- **INSERT** - A row is inserted into a table.
|
||||||
- **UPDATE** - A row is updated in a table
|
- **UPDATE** - A row is updated in a table.
|
||||||
- **DELETE** - A row is deleted from a table
|
- **DELETE** - A row is deleted from a table.
|
||||||
|
|
||||||
Event Triggers can also be triggered manually in the Hasura Console.
|
:::info
|
||||||
|
|
||||||
|
It's currently only possible to create Event Triggers in the Hasura Console. We're working on adding support for creating Event Triggers in the Nhost Dashboard.
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
### Example Use Case
|
### Example Use Case
|
||||||
|
|
||||||
@@ -30,7 +34,7 @@ Event Triggers are managed in the Hasura Console. Select **Events** in the main
|
|||||||
|
|
||||||
## Event Triggers and Serverless Functions
|
## Event Triggers and Serverless Functions
|
||||||
|
|
||||||
Event Triggers and [Serverless Functions](/platform/serverless-functions) is a perfect combination to build powerful database-backend logic. Every Serverless Function is exposed as an HTTP endpoint that can be used as a webhook for your Event Triggers.
|
Event Triggers and [Serverless Functions](/platform/serverless-functions) is a perfect combination to build powerful database-backend logic. Every Serverless Function is exposed as an HTTP endpoint and can be used as a webhook for Event Triggers.
|
||||||
|
|
||||||
### Format
|
### Format
|
||||||
|
|
||||||
@@ -40,7 +44,7 @@ When using Serverless Functions as webhooks you should configure the webhook usi
|
|||||||
{{NHOST_BACKEND_URL}}/v1/functions/orders-insert-send-email
|
{{NHOST_BACKEND_URL}}/v1/functions/orders-insert-send-email
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
The `NHOST_BACKEND_URL` is a [system environment variable](/platform/environment-variables#system-environment-variables) and available in production and in development environments using the [CLI](/platform/cli).
|
The `NHOST_BACKEND_URL` is a [system environment variable](/platform/environment-variables#system-environment-variables) and available in production and in development environments using the [CLI](/platform/cli).
|
||||||
|
|
||||||
@@ -54,7 +58,7 @@ To set this up is a two-step process:
|
|||||||
|
|
||||||
- Step 1: Add the header `nhost-webhook-secret` with the value `NHOST_WEBHOOK_SECRET` (From env var) when creating the Event Trigger in the Hasura Console.
|
- Step 1: Add the header `nhost-webhook-secret` with the value `NHOST_WEBHOOK_SECRET` (From env var) when creating the Event Trigger in the Hasura Console.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- Step 2: Check the header `nhost-webhook-secret` for incoming requests and make sure the header is the same as the environment variable `NHOST_WEBHOOK_SECRET`.
|
- Step 2: Check the header `nhost-webhook-secret` for incoming requests and make sure the header is the same as the environment variable `NHOST_WEBHOOK_SECRET`.
|
||||||
|
|
||||||
|
|||||||
@@ -9,52 +9,40 @@ import TabItem from '@theme/TabItem'
|
|||||||
|
|
||||||
Every Nhost project comes with its own [Postgres database](https://postgres.org/). Postgres is the world's most advanced open-source relational database and it's the most [popular SQL database for developers](https://insights.stackoverflow.com/survey/2021#section-most-loved-dreaded-and-wanted-databases).
|
Every Nhost project comes with its own [Postgres database](https://postgres.org/). Postgres is the world's most advanced open-source relational database and it's the most [popular SQL database for developers](https://insights.stackoverflow.com/survey/2021#section-most-loved-dreaded-and-wanted-databases).
|
||||||
|
|
||||||
:::info
|
There are three ways of managing your database:
|
||||||
|
|
||||||
It's currently not possible to connect directly to the Postgres database via a connection string. We're working on making the database available soon. You can follow [this issue on GitHub](https://github.com/nhost/nhost/issues/113).
|
1. Nhost Database UI (recommended).
|
||||||
|
2. Hasura Console.
|
||||||
:::
|
3. [Connect directly to the database.](#postgres-access)
|
||||||
|
|
||||||
The database is managed via the Hasura Console where you can manage the database via an intuitive UI. You can also use SQL to directly interact with the database via the Hasura Console.
|
|
||||||
|
|
||||||
## Hasura Console
|
|
||||||
|
|
||||||
Hasura Console is where you manage your database. This is where you create and manage tables, schemas, and data.
|
|
||||||
|
|
||||||
1. Open the Hasura Console by clicking on **GraphQL** in the top menu in the Nhost Dashboard.
|
|
||||||
2. Click **Open Hasura Console** at the top right of the page.
|
|
||||||
3. Copy the **admin secret**, and click **Open Hasura**.
|
|
||||||
4. Use the **admin secret** to sign in.
|
|
||||||
|
|
||||||
<video width="99%" autoPlay muted loop controls="true">
|
|
||||||
<source src="/videos/open-hasura-console.mp4" type="video/mp4" />
|
|
||||||
</video>
|
|
||||||
|
|
||||||
## Schemas
|
## Schemas
|
||||||
|
|
||||||
The two schemas `auth` and `storage` are reserved for Nhost Auth and Nhost Storage to work. You're allowed to modify **permissions** and **add relationships**. However, never modify any tables or remove relationships that were added by Nhost inside the `auth` and `storage` schemas.
|
Generally, you should use the `public` schema for your project. It's also ok to add custom schemas for more advanced usage.
|
||||||
|
|
||||||
Generally, you should use the `public` schema when creating and managing your tables for your project. It's also ok to add custom schemas for more advanced usage.
|
The two schemas `auth` and `storage` are reserved for [Nhost Auth](/platform/authentication) and [Nhost Storage](/platform/storage). You're allowed to modify **permissions** and **add relationships**. However, never modify any tables or remove relationships that were added by Nhost inside the `auth` and `storage` schemas.
|
||||||
|
|
||||||
## Create Table
|
## Manage Tables
|
||||||
|
|
||||||
1. In Hasura Console, go to the **Data** tab, select the **public** schema in the left menu and click **Create Table**.
|
### Create Table
|
||||||
2. Enter a table name.
|
|
||||||
3. Add table columns.
|
|
||||||
4. Add a primary key (usually the ID column).
|
|
||||||
5. (Optional) Add foreign keys.
|
|
||||||
6. (Optional) Add unique keys.
|
|
||||||
7. Click **Add Table**.
|
|
||||||
|
|
||||||
When a table is created the table is instantly available through the [GraphQL API](/platform/graphql).
|
1. Go to **Database** in the left menu.
|
||||||
|
2. Click **New table**.
|
||||||
|
3. Enter a **name** for the table.
|
||||||
|
4. Add **columns**.
|
||||||
|
5. Select a **Primary Key** (usually the `id` column).
|
||||||
|
6. (Optional) Select an **Identity** column. Identity is for integer columns only and is usually selected for the `id` column so the `id` is automatically incremented (1,2,3...) on new rows.
|
||||||
|
7. (Optional) Add **Foreign Keys**.
|
||||||
|
8. Click **Create**.
|
||||||
|
|
||||||
|
When a table is created it is instantly available through the [GraphQL API](/platform/graphql).
|
||||||
|
|
||||||
Here's an example of how to create a `customers` table:
|
Here's an example of how to create a `customers` table:
|
||||||
|
|
||||||
<Tabs groupId="hasura-console-vs-sql">
|
<Tabs groupId="nhost-vs-sql">
|
||||||
<TabItem value="hasura-cosnole" label="Hasura Console" default>
|
<TabItem value="nhost" label="Nhost" default>
|
||||||
|
|
||||||
<video width="99%" autoPlay muted loop controls="true">
|
<video width="99%" autoPlay muted loop controls="true">
|
||||||
<source src="/videos/hasura-create-table.mp4" type="video/mp4" />
|
<source src="/videos/nhost-table-create.mp4" type="video/mp4" />
|
||||||
</video>
|
</video>
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
@@ -62,7 +50,7 @@ Here's an example of how to create a `customers` table:
|
|||||||
|
|
||||||
```sql
|
```sql
|
||||||
CREATE TABLE "public"."customers" (
|
CREATE TABLE "public"."customers" (
|
||||||
"id" serial NOT NULL PRIMARY KEY,
|
"id" bigint PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
|
||||||
"name" text NOT NULL
|
"name" text NOT NULL
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
@@ -70,19 +58,20 @@ CREATE TABLE "public"."customers" (
|
|||||||
</TabItem>
|
</TabItem>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
## Modify Table
|
### Edit Table
|
||||||
|
|
||||||
1. In Hasura Console, go to the **Data** tab and click on the table you want to edit in the left menu.
|
1. Go to the **Database** in the left menu
|
||||||
2. Click **Modify**.
|
2. Click on the **context menu** of the table you want to change and click **Edit table**.
|
||||||
3. Modify or add table columns.
|
3. **Edit** (add, change, delete) the table's columns.
|
||||||
|
4. Click **Save**.
|
||||||
|
|
||||||
Here's an example of how to modify a `customers` table by adding an `address` column:
|
Here's an example of how to edit a `customers` table by adding an `address` column:
|
||||||
|
|
||||||
<Tabs groupId="hasura-console-vs-sql">
|
<Tabs groupId="nhost-vs-sql">
|
||||||
<TabItem value="hasura-cosnole" label="Hasura Console" default>
|
<TabItem value="nhost" label="Nhost" default>
|
||||||
|
|
||||||
<video width="99%" autoPlay muted loop controls="true">
|
<video width="99%" autoPlay muted loop controls="true">
|
||||||
<source src="/videos/hasura-modify-table.mp4" type="video/mp4" />
|
<source src="/videos/nhost-table-edit.mp4" type="video/mp4" />
|
||||||
</video>
|
</video>
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
@@ -95,20 +84,19 @@ ALTER TABLE "public"."customers" ADD COLUMN "address" text;
|
|||||||
</TabItem>
|
</TabItem>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
## Delete Table
|
### Delete Table
|
||||||
|
|
||||||
1. In Hasura Console, go to the **Data** tab and select the table you want to delete in the left menu.
|
1. Go to the **Database** in the left menu
|
||||||
2. Click **Modify**.
|
2. Click on the **context menu** of the table you want to delete and click **Delete table**.
|
||||||
3. Scroll to the bottom of the page and click **Delete table** to open the confirmation dialog.
|
3. Click **Delete** to confirm deleting the table.
|
||||||
4. Type the **name of the table** and click OK.
|
|
||||||
|
|
||||||
Here's an example of how to delete a `customers` table:
|
**Example:** Delete a `customers` table:
|
||||||
|
|
||||||
<Tabs groupId="hasura-console-vs-sql">
|
<Tabs groupId="nhost-vs-sql">
|
||||||
<TabItem value="hasura-cosnole" label="Hasura Console" default>
|
<TabItem value="nhost" label="Nhost" default>
|
||||||
|
|
||||||
<video width="99%" autoPlay muted loop controls="true">
|
<video width="99%" autoPlay muted loop controls="true">
|
||||||
<source src="/videos/hasura-delete-table.mp4" type="video/mp4" />
|
<source src="/videos/nhost-table-delete.mp4" type="video/mp4" />
|
||||||
</video>
|
</video>
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
@@ -121,6 +109,34 @@ DROP TABLE "public"."customers";
|
|||||||
</TabItem>
|
</TabItem>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
|
## Postgres Access
|
||||||
|
|
||||||
|
It's possible to access your Postgres database directly with your favorite Postgres client.
|
||||||
|
|
||||||
|
:::info
|
||||||
|
|
||||||
|
For projects older than September 2022, it's not possible to connect directly to the database via a connection string. We're working on a one-click fix that can be expected to be available in October 2022.
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
Go to **Settings** in the left menu and click on **Database**. You'll find the connection string and credentials to connect to your database.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Reset Postgres Password
|
||||||
|
|
||||||
|
It's possible to reset the database password that was provided when the project was created.
|
||||||
|
|
||||||
|
1. Go to the **Overview** page of your project.
|
||||||
|
2. Click on **Project Settings**.
|
||||||
|
3. Click on **Reset Database Password**.
|
||||||
|
4. Either **copy** the newly automatically generated password, or **type** your own new database password.
|
||||||
|
5. Click **Reset Database Password**.
|
||||||
|
|
||||||
|
<video width="99%" autoPlay muted loop controls="true">
|
||||||
|
<source src="/videos/nhost-database-reset-password.mp4" type="video/mp4" />
|
||||||
|
</video>
|
||||||
|
|
||||||
## Migrations
|
## Migrations
|
||||||
|
|
||||||
To track database changes, use the [Nhost CLI](/platform/cli) to develop locally and use our [GitHub integration](/platform/github-integration) to automatically deploy database migrations live.
|
To track database changes, use the [Nhost CLI](/platform/cli) to develop locally and use our [GitHub integration](/platform/github-integration) to automatically deploy database migrations live.
|
||||||
@@ -148,12 +164,14 @@ nhost/seeds/default/002-products.sql
|
|||||||
|
|
||||||
## Backups
|
## Backups
|
||||||
|
|
||||||
Databases on [Pro and Enterprise plans](https://nhost.io/pricing) are backed up automatically.
|
Databases on the [Pro and Enterprise plans](https://nhost.io/pricing) are automatically backed up daily.
|
||||||
|
|
||||||
## Best Practices
|
## Best Practices
|
||||||
|
|
||||||
- Use lower-case names for tables. E.g. `customers` instead of `Customers`.
|
- Use lower-case names for tables. E.g. `customers` instead of `Customers`.
|
||||||
- Use plural names for tables. E.g. `customers` instead of `customer`.
|
- Use plural names for tables. E.g. `customers` instead of `customer`.
|
||||||
|
- use underscore (`_`) instead of camelCase for table names. E.g. `customer_invoices` instead of `customerInvoices`.
|
||||||
|
- use underscore (`_`) instead of camelCase for column names. E.g. `first_name` instead of `firstName`.
|
||||||
|
|
||||||
## Next Steps
|
## Next Steps
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: signUp()
|
|||||||
sidebar_label: signUp()
|
sidebar_label: signUp()
|
||||||
slug: /reference/javascript/auth/sign-up
|
slug: /reference/javascript/auth/sign-up
|
||||||
description: Use `nhost.auth.signUp` to sign up a user using email and password. If you want to sign up a user using passwordless email (Magic Link), SMS, or an OAuth provider, use the `signIn` function instead.
|
description: Use `nhost.auth.signUp` to sign up a user using email and password. If you want to sign up a user using passwordless email (Magic Link), SMS, or an OAuth provider, use the `signIn` function instead.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L106
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L107
|
||||||
---
|
---
|
||||||
|
|
||||||
# `signUp()`
|
# `signUp()`
|
||||||
@@ -22,12 +22,6 @@ nhost.auth.signUp({
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**<span className="parameter-name">\_\_namedParameters</span>** <span className="optional-status">required</span> [`SignUpEmailPasswordParams`](/reference/docgen/javascript/auth/types/sign-up-email-password-params)
|
**<span className="parameter-name">params</span>** <span className="optional-status">required</span> [`SignUpParams`](/reference/docgen/javascript/auth/types/sign-up-params)
|
||||||
|
|
||||||
| Property | Type | Required | Notes |
|
|
||||||
| :------------------------------------------------------------------------------------------------------- | :-------------- | :------: | :---- |
|
|
||||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>password</span> | `string` | ✔️ | |
|
|
||||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>email</span> | `string` | ✔️ | |
|
|
||||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>options</span> | `SignUpOptions` | | |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: signIn()
|
|||||||
sidebar_label: signIn()
|
sidebar_label: signIn()
|
||||||
slug: /reference/javascript/auth/sign-in
|
slug: /reference/javascript/auth/sign-in
|
||||||
description: Use `nhost.auth.signIn` to sign in a user using email and password, passwordless (email or sms) or an external provider. `signIn` can be used to sign in a user in various ways depending on the parameters.
|
description: Use `nhost.auth.signIn` to sign in a user using email and password, passwordless (email or sms) or an external provider. `signIn` can be used to sign in a user in various ways depending on the parameters.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L149
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L156
|
||||||
---
|
---
|
||||||
|
|
||||||
# `signIn()`
|
# `signIn()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: signOut()
|
|||||||
sidebar_label: signOut()
|
sidebar_label: signOut()
|
||||||
slug: /reference/javascript/auth/sign-out
|
slug: /reference/javascript/auth/sign-out
|
||||||
description: Use `nhost.auth.signOut` to sign out the user.
|
description: Use `nhost.auth.signOut` to sign out the user.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L245
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L252
|
||||||
---
|
---
|
||||||
|
|
||||||
# `signOut()`
|
# `signOut()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: resetPassword()
|
|||||||
sidebar_label: resetPassword()
|
sidebar_label: resetPassword()
|
||||||
slug: /reference/javascript/auth/reset-password
|
slug: /reference/javascript/auth/reset-password
|
||||||
description: Use `nhost.auth.resetPassword` to reset the password for a user. This will send a reset-password link in an email to the user. When the user clicks the reset-password link the user is automatically signed-in. Once signed-in, the user can change their password using `nhost.auth.changePassword()`.
|
description: Use `nhost.auth.resetPassword` to reset the password for a user. This will send a reset-password link in an email to the user. When the user clicks the reset-password link the user is automatically signed-in. Once signed-in, the user can change their password using `nhost.auth.changePassword()`.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L261
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L268
|
||||||
---
|
---
|
||||||
|
|
||||||
# `resetPassword()`
|
# `resetPassword()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: changePassword()
|
|||||||
sidebar_label: changePassword()
|
sidebar_label: changePassword()
|
||||||
slug: /reference/javascript/auth/change-password
|
slug: /reference/javascript/auth/change-password
|
||||||
description: Use `nhost.auth.changePassword` to change the password for the signed-in user. The old password is not needed. In case the user is not signed-in, a password reset ticket needs to be provided.
|
description: Use `nhost.auth.changePassword` to change the password for the signed-in user. The old password is not needed. In case the user is not signed-in, a password reset ticket needs to be provided.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L277
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L284
|
||||||
---
|
---
|
||||||
|
|
||||||
# `changePassword()`
|
# `changePassword()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: sendVerificationEmail()
|
|||||||
sidebar_label: sendVerificationEmail()
|
sidebar_label: sendVerificationEmail()
|
||||||
slug: /reference/javascript/auth/send-verification-email
|
slug: /reference/javascript/auth/send-verification-email
|
||||||
description: Use `nhost.auth.sendVerificationEmail` to send a verification email to the specified email. The email contains a verification-email link. When the user clicks the verification-email link their email is verified.
|
description: Use `nhost.auth.sendVerificationEmail` to send a verification email to the specified email. The email contains a verification-email link. When the user clicks the verification-email link their email is verified.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L296
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L303
|
||||||
---
|
---
|
||||||
|
|
||||||
# `sendVerificationEmail()`
|
# `sendVerificationEmail()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: changeEmail()
|
|||||||
sidebar_label: changeEmail()
|
sidebar_label: changeEmail()
|
||||||
slug: /reference/javascript/auth/change-email
|
slug: /reference/javascript/auth/change-email
|
||||||
description: Use `nhost.auth.changeEmail` to change a user's email. This will send a confirm-email-change link in an email to the new email. Once the user clicks on the confirm-email-change link the email will be change to the new email.
|
description: Use `nhost.auth.changeEmail` to change a user's email. This will send a confirm-email-change link in an email to the new email. Once the user clicks on the confirm-email-change link the email will be change to the new email.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L315
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L322
|
||||||
---
|
---
|
||||||
|
|
||||||
# `changeEmail()`
|
# `changeEmail()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: deanonymize()
|
|||||||
sidebar_label: deanonymize()
|
sidebar_label: deanonymize()
|
||||||
slug: /reference/javascript/auth/deanonymize
|
slug: /reference/javascript/auth/deanonymize
|
||||||
description: Use `nhost.auth.deanonymize` to deanonymize a user.
|
description: Use `nhost.auth.deanonymize` to deanonymize a user.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L331
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L338
|
||||||
---
|
---
|
||||||
|
|
||||||
# `deanonymize()`
|
# `deanonymize()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: addSecurityKey()
|
|||||||
sidebar_label: addSecurityKey()
|
sidebar_label: addSecurityKey()
|
||||||
slug: /reference/javascript/auth/add-security-key
|
slug: /reference/javascript/auth/add-security-key
|
||||||
description: Use `nhost.auth.addSecurityKey to add a security key to the user, using the WebAuthn API.
|
description: Use `nhost.auth.addSecurityKey to add a security key to the user, using the WebAuthn API.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L369
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L376
|
||||||
---
|
---
|
||||||
|
|
||||||
# `addSecurityKey()`
|
# `addSecurityKey()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: onTokenChanged()
|
|||||||
sidebar_label: onTokenChanged()
|
sidebar_label: onTokenChanged()
|
||||||
slug: /reference/javascript/auth/on-token-changed
|
slug: /reference/javascript/auth/on-token-changed
|
||||||
description: Use `nhost.auth.onTokenChanged` to add a custom function that runs every time the access or refresh token is changed.
|
description: Use `nhost.auth.onTokenChanged` to add a custom function that runs every time the access or refresh token is changed.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L387
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L394
|
||||||
---
|
---
|
||||||
|
|
||||||
# `onTokenChanged()`
|
# `onTokenChanged()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: onAuthStateChanged()
|
|||||||
sidebar_label: onAuthStateChanged()
|
sidebar_label: onAuthStateChanged()
|
||||||
slug: /reference/javascript/auth/on-auth-state-changed
|
slug: /reference/javascript/auth/on-auth-state-changed
|
||||||
description: Use `nhost.auth.onAuthStateChanged` to add a custom function that runs every time the authentication status of the user changes. E.g. add a custom function that runs every time the authentication status changes from signed-in to signed-out.
|
description: Use `nhost.auth.onAuthStateChanged` to add a custom function that runs every time the authentication status of the user changes. E.g. add a custom function that runs every time the authentication status changes from signed-in to signed-out.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L422
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L429
|
||||||
---
|
---
|
||||||
|
|
||||||
# `onAuthStateChanged()`
|
# `onAuthStateChanged()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: isAuthenticated()
|
|||||||
sidebar_label: isAuthenticated()
|
sidebar_label: isAuthenticated()
|
||||||
slug: /reference/javascript/auth/is-authenticated
|
slug: /reference/javascript/auth/is-authenticated
|
||||||
description: Use `nhost.auth.isAuthenticated` to check if the user is authenticated or not.
|
description: Use `nhost.auth.isAuthenticated` to check if the user is authenticated or not.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L464
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L471
|
||||||
---
|
---
|
||||||
|
|
||||||
# `isAuthenticated()`
|
# `isAuthenticated()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: isAuthenticatedAsync()
|
|||||||
sidebar_label: isAuthenticatedAsync()
|
sidebar_label: isAuthenticatedAsync()
|
||||||
slug: /reference/javascript/auth/is-authenticated-async
|
slug: /reference/javascript/auth/is-authenticated-async
|
||||||
description: Use `nhost.auth.isAuthenticatedAsync` to wait (await) for any internal authentication network requests to finish and then return the authentication status.
|
description: Use `nhost.auth.isAuthenticatedAsync` to wait (await) for any internal authentication network requests to finish and then return the authentication status.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L482
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L489
|
||||||
---
|
---
|
||||||
|
|
||||||
# `isAuthenticatedAsync()`
|
# `isAuthenticatedAsync()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: getAuthenticationStatus()
|
|||||||
sidebar_label: getAuthenticationStatus()
|
sidebar_label: getAuthenticationStatus()
|
||||||
slug: /reference/javascript/auth/get-authentication-status
|
slug: /reference/javascript/auth/get-authentication-status
|
||||||
description: Use `nhost.auth.getAuthenticationStatus` to get the authentication status of the user.
|
description: Use `nhost.auth.getAuthenticationStatus` to get the authentication status of the user.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L508
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L515
|
||||||
---
|
---
|
||||||
|
|
||||||
# `getAuthenticationStatus()`
|
# `getAuthenticationStatus()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: getAccessToken()
|
|||||||
sidebar_label: getAccessToken()
|
sidebar_label: getAccessToken()
|
||||||
slug: /reference/javascript/auth/get-access-token
|
slug: /reference/javascript/auth/get-access-token
|
||||||
description: Use `nhost.auth.getAccessToken` to get the access token of the user.
|
description: Use `nhost.auth.getAccessToken` to get the access token of the user.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L538
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L545
|
||||||
---
|
---
|
||||||
|
|
||||||
# `getAccessToken()`
|
# `getAccessToken()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: getDecodedAccessToken()
|
|||||||
sidebar_label: getDecodedAccessToken()
|
sidebar_label: getDecodedAccessToken()
|
||||||
slug: /reference/javascript/auth/get-decoded-access-token
|
slug: /reference/javascript/auth/get-decoded-access-token
|
||||||
description: Use `nhost.auth.getDecodedAccessToken` to get the decoded access token of the user.
|
description: Use `nhost.auth.getDecodedAccessToken` to get the decoded access token of the user.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L553
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L560
|
||||||
---
|
---
|
||||||
|
|
||||||
# `getDecodedAccessToken()`
|
# `getDecodedAccessToken()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: getHasuraClaims()
|
|||||||
sidebar_label: getHasuraClaims()
|
sidebar_label: getHasuraClaims()
|
||||||
slug: /reference/javascript/auth/get-hasura-claims
|
slug: /reference/javascript/auth/get-hasura-claims
|
||||||
description: Use `nhost.auth.getHasuraClaims` to get the Hasura claims of the user.
|
description: Use `nhost.auth.getHasuraClaims` to get the Hasura claims of the user.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L570
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L577
|
||||||
---
|
---
|
||||||
|
|
||||||
# `getHasuraClaims()`
|
# `getHasuraClaims()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: getHasuraClaim()
|
|||||||
sidebar_label: getHasuraClaim()
|
sidebar_label: getHasuraClaim()
|
||||||
slug: /reference/javascript/auth/get-hasura-claim
|
slug: /reference/javascript/auth/get-hasura-claim
|
||||||
description: Use `nhost.auth.getHasuraClaim` to get the value of a specific Hasura claim of the user.
|
description: Use `nhost.auth.getHasuraClaim` to get the value of a specific Hasura claim of the user.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L588
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L595
|
||||||
---
|
---
|
||||||
|
|
||||||
# `getHasuraClaim()`
|
# `getHasuraClaim()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: refreshSession()
|
|||||||
sidebar_label: refreshSession()
|
sidebar_label: refreshSession()
|
||||||
slug: /reference/javascript/auth/refresh-session
|
slug: /reference/javascript/auth/refresh-session
|
||||||
description: Use `nhost.auth.refreshSession` to refresh the session with either the current internal refresh token or an external refresh token.
|
description: Use `nhost.auth.refreshSession` to refresh the session with either the current internal refresh token or an external refresh token.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L611
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L618
|
||||||
---
|
---
|
||||||
|
|
||||||
# `refreshSession()`
|
# `refreshSession()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: getSession()
|
|||||||
sidebar_label: getSession()
|
sidebar_label: getSession()
|
||||||
slug: /reference/javascript/auth/get-session
|
slug: /reference/javascript/auth/get-session
|
||||||
description: Use `nhost.auth.getSession()` to get the session of the user.
|
description: Use `nhost.auth.getSession()` to get the session of the user.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L652
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L659
|
||||||
---
|
---
|
||||||
|
|
||||||
# `getSession()`
|
# `getSession()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: getUser()
|
|||||||
sidebar_label: getUser()
|
sidebar_label: getUser()
|
||||||
slug: /reference/javascript/auth/get-user
|
slug: /reference/javascript/auth/get-user
|
||||||
description: Use `nhost.auth.getUser()` to get the signed-in user.
|
description: Use `nhost.auth.getUser()` to get the signed-in user.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L667
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L674
|
||||||
---
|
---
|
||||||
|
|
||||||
# `getUser()`
|
# `getUser()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: HasuraAuthClient
|
|||||||
sidebar_label: Auth
|
sidebar_label: Auth
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
slug: /reference/javascript/auth
|
slug: /reference/javascript/auth
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L63
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L64
|
||||||
---
|
---
|
||||||
|
|
||||||
# `HasuraAuthClient`
|
# `HasuraAuthClient`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: AuthChangeEvent
|
|||||||
sidebar_label: AuthChangeEvent
|
sidebar_label: AuthChangeEvent
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L107
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L118
|
||||||
---
|
---
|
||||||
|
|
||||||
# `AuthChangeEvent`
|
# `AuthChangeEvent`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: AuthChangedFunction
|
|||||||
sidebar_label: AuthChangedFunction
|
sidebar_label: AuthChangedFunction
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L109
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L120
|
||||||
---
|
---
|
||||||
|
|
||||||
# `AuthChangedFunction`
|
# `AuthChangedFunction`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: ChangeEmailParams
|
|||||||
sidebar_label: ChangeEmailParams
|
sidebar_label: ChangeEmailParams
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L89
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L99
|
||||||
---
|
---
|
||||||
|
|
||||||
# `ChangeEmailParams`
|
# `ChangeEmailParams`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: ChangePasswordParams
|
|||||||
sidebar_label: ChangePasswordParams
|
sidebar_label: ChangePasswordParams
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L79
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L89
|
||||||
---
|
---
|
||||||
|
|
||||||
# `ChangePasswordParams`
|
# `ChangePasswordParams`
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
|
title: CommonSignUpParams
|
||||||
|
sidebar_label: CommonSignUpParams
|
||||||
|
description: No description provided.
|
||||||
|
displayed_sidebar: referenceSidebar
|
||||||
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L25
|
||||||
|
---
|
||||||
|
|
||||||
|
# `CommonSignUpParams`
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">options</span>** <span className="optional-status">optional</span> `SignUpOptions`
|
||||||
|
|
||||||
|
---
|
||||||
@@ -4,14 +4,14 @@ title: DeanonymizeParams
|
|||||||
sidebar_label: DeanonymizeParams
|
sidebar_label: DeanonymizeParams
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L94
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L104
|
||||||
---
|
---
|
||||||
|
|
||||||
# `DeanonymizeParams`
|
# `DeanonymizeParams`
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
type DeanonymizeParams =
|
type DeanonymizeParams =
|
||||||
| ({ signInMethod: 'email-password' } & SignUpParams)
|
| ({ signInMethod: 'email-password' } & SignUpEmailPasswordParams)
|
||||||
| ({
|
| ({
|
||||||
signInMethod: 'passwordless'
|
signInMethod: 'passwordless'
|
||||||
connection: 'email'
|
connection: 'email'
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: NhostAuthConstructorParams
|
|||||||
sidebar_label: NhostAuthConstructorParams
|
sidebar_label: NhostAuthConstructorParams
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L16
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L17
|
||||||
---
|
---
|
||||||
|
|
||||||
# `NhostAuthConstructorParams`
|
# `NhostAuthConstructorParams`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: OnTokenChangedFunction
|
|||||||
sidebar_label: OnTokenChangedFunction
|
sidebar_label: OnTokenChangedFunction
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L111
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L122
|
||||||
---
|
---
|
||||||
|
|
||||||
# `OnTokenChangedFunction`
|
# `OnTokenChangedFunction`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: Provider
|
|||||||
sidebar_label: Provider
|
sidebar_label: Provider
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/core/src/types.ts#L148
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/core/src/types.ts#L153
|
||||||
---
|
---
|
||||||
|
|
||||||
# `Provider`
|
# `Provider`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: ResetPasswordParams
|
|||||||
sidebar_label: ResetPasswordParams
|
sidebar_label: ResetPasswordParams
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L74
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L84
|
||||||
---
|
---
|
||||||
|
|
||||||
# `ResetPasswordParams`
|
# `ResetPasswordParams`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: SendVerificationEmailParams
|
|||||||
sidebar_label: SendVerificationEmailParams
|
sidebar_label: SendVerificationEmailParams
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L84
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L94
|
||||||
---
|
---
|
||||||
|
|
||||||
# `SendVerificationEmailParams`
|
# `SendVerificationEmailParams`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: SignInEmailPasswordOtpParams
|
|||||||
sidebar_label: SignInEmailPasswordOtpParams
|
sidebar_label: SignInEmailPasswordOtpParams
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L36
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L46
|
||||||
---
|
---
|
||||||
|
|
||||||
# `SignInEmailPasswordOtpParams`
|
# `SignInEmailPasswordOtpParams`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: SignInEmailPasswordParams
|
|||||||
sidebar_label: SignInEmailPasswordParams
|
sidebar_label: SignInEmailPasswordParams
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L31
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L41
|
||||||
---
|
---
|
||||||
|
|
||||||
# `SignInEmailPasswordParams`
|
# `SignInEmailPasswordParams`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: SignInParams
|
|||||||
sidebar_label: SignInParams
|
sidebar_label: SignInParams
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L65
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L75
|
||||||
---
|
---
|
||||||
|
|
||||||
# `SignInParams`
|
# `SignInParams`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: SignInPasswordlessEmailParams
|
|||||||
sidebar_label: SignInPasswordlessEmailParams
|
sidebar_label: SignInPasswordlessEmailParams
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L41
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L51
|
||||||
---
|
---
|
||||||
|
|
||||||
# `SignInPasswordlessEmailParams`
|
# `SignInPasswordlessEmailParams`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: SignInPasswordlessSecurityKeyParams
|
|||||||
sidebar_label: SignInPasswordlessSecurityKeyParams
|
sidebar_label: SignInPasswordlessSecurityKeyParams
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L46
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L56
|
||||||
---
|
---
|
||||||
|
|
||||||
# `SignInPasswordlessSecurityKeyParams`
|
# `SignInPasswordlessSecurityKeyParams`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: SignInPasswordlessSmsOtpParams
|
|||||||
sidebar_label: SignInPasswordlessSmsOtpParams
|
sidebar_label: SignInPasswordlessSmsOtpParams
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L56
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L66
|
||||||
---
|
---
|
||||||
|
|
||||||
# `SignInPasswordlessSmsOtpParams`
|
# `SignInPasswordlessSmsOtpParams`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: SignInPasswordlessSmsParams
|
|||||||
sidebar_label: SignInPasswordlessSmsParams
|
sidebar_label: SignInPasswordlessSmsParams
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L51
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L61
|
||||||
---
|
---
|
||||||
|
|
||||||
# `SignInPasswordlessSmsParams`
|
# `SignInPasswordlessSmsParams`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: SignInWithProviderOptions
|
|||||||
sidebar_label: SignInWithProviderOptions
|
sidebar_label: SignInWithProviderOptions
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L61
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L71
|
||||||
---
|
---
|
||||||
|
|
||||||
# `SignInWithProviderOptions`
|
# `SignInWithProviderOptions`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: SignUpEmailPasswordParams
|
|||||||
sidebar_label: SignUpEmailPasswordParams
|
sidebar_label: SignUpEmailPasswordParams
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L24
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L29
|
||||||
---
|
---
|
||||||
|
|
||||||
# `SignUpEmailPasswordParams`
|
# `SignUpEmailPasswordParams`
|
||||||
@@ -13,7 +13,7 @@ custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-j
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**<span className="parameter-name">password</span>** <span className="optional-status">required</span> `string`
|
**<span className="parameter-name">options</span>** <span className="optional-status">optional</span> `SignUpOptions`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -21,6 +21,6 @@ custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-j
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**<span className="parameter-name">options</span>** <span className="optional-status">optional</span> `SignUpOptions`
|
**<span className="parameter-name">password</span>** <span className="optional-status">required</span> `string`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -4,7 +4,11 @@ title: SignUpParams
|
|||||||
sidebar_label: SignUpParams
|
sidebar_label: SignUpParams
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L30
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L40
|
||||||
---
|
---
|
||||||
|
|
||||||
# `SignUpParams`
|
# `SignUpParams`
|
||||||
|
|
||||||
|
```ts
|
||||||
|
type SignUpParams = SignUpEmailPasswordParams | SignUpSecurityKeyParams
|
||||||
|
```
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
|
title: SignUpSecurityKeyParams
|
||||||
|
sidebar_label: SignUpSecurityKeyParams
|
||||||
|
description: No description provided.
|
||||||
|
displayed_sidebar: referenceSidebar
|
||||||
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L34
|
||||||
|
---
|
||||||
|
|
||||||
|
# `SignUpSecurityKeyParams`
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">email</span>** <span className="optional-status">required</span> `string`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">options</span>** <span className="optional-status">optional</span> `SignUpSecurityKeyOptions`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">securityKey</span>** <span className="optional-status">required</span> `"true"`
|
||||||
|
|
||||||
|
---
|
||||||
@@ -4,7 +4,7 @@ title: User
|
|||||||
sidebar_label: User
|
sidebar_label: User
|
||||||
description: User information
|
description: User information
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/core/src/types.ts#L101
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/core/src/types.ts#L106
|
||||||
---
|
---
|
||||||
|
|
||||||
# `User`
|
# `User`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: NhostAuthConstructorParams
|
|||||||
sidebar_label: NhostAuthConstructorParams
|
sidebar_label: NhostAuthConstructorParams
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L16
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L17
|
||||||
---
|
---
|
||||||
|
|
||||||
# `NhostAuthConstructorParams`
|
# `NhostAuthConstructorParams`
|
||||||
|
|||||||
@@ -1,31 +1,31 @@
|
|||||||
---
|
---
|
||||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
title: useSignInSecurityKeyEmail()
|
title: useSignInEmailSecurityKey()
|
||||||
sidebar_label: useSignInSecurityKeyEmail()
|
sidebar_label: useSignInEmailSecurityKey()
|
||||||
slug: /reference/nextjs/use-sign-in-security-key-email
|
slug: /reference/nextjs/use-sign-in-email-security-key
|
||||||
description: Use the hook `useSignInSecurityKeyEmail` to sign in a user using their email and a security key using the WebAuthn API.
|
description: Use the hook `useSignInEmailSecurityKey` to sign in a user using their email and a security key using the WebAuthn API.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignInSecurityKeyEmail.ts#L41
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignInEmailSecurityKey.ts#L41
|
||||||
---
|
---
|
||||||
|
|
||||||
# `useSignInSecurityKeyEmail()`
|
# `useSignInEmailSecurityKey()`
|
||||||
|
|
||||||
Use the hook `useSignInSecurityKeyEmail` to sign in a user using their email and a security key using the WebAuthn API.
|
Use the hook `useSignInEmailSecurityKey` to sign in a user using their email and a security key using the WebAuthn API.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
const {
|
const {
|
||||||
signInSecurityKeyEmail,
|
signInEmailSecurityKey,
|
||||||
needsEmailVerification,
|
needsEmailVerification,
|
||||||
isLoading,
|
isLoading,
|
||||||
isSuccess,
|
isSuccess,
|
||||||
isError,
|
isError,
|
||||||
error
|
error
|
||||||
} = useSignInSecurityKeyEmail()
|
} = useSignInEmailSecurityKey()
|
||||||
|
|
||||||
console.log({ needsEmailVerification, isLoading, isSuccess, isError, error })
|
console.log({ needsEmailVerification, isLoading, isSuccess, isError, error })
|
||||||
|
|
||||||
const handleFormSubmit = async (e) => {
|
const handleFormSubmit = async (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
await signInSecurityKeyEmail('joe@example.com')
|
await signInEmailSecurityKey('joe@example.com')
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
---
|
||||||
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
|
title: useSignUpEmailSecurityKeyEmail()
|
||||||
|
sidebar_label: useSignUpEmailSecurityKeyEmail()
|
||||||
|
slug: /reference/nextjs/use-sign-up-email-security-key-email
|
||||||
|
description: Use the hook `useSignUpEmailSecurityKey` to sign up a user with security key and an email using the WebAuthn API.
|
||||||
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignUpEmailSecurityKey.ts#L43
|
||||||
|
---
|
||||||
|
|
||||||
|
# `useSignUpEmailSecurityKeyEmail()`
|
||||||
|
|
||||||
|
Use the hook `useSignUpEmailSecurityKey` to sign up a user with security key and an email using the WebAuthn API.
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
const {
|
||||||
|
signUpEmailSecurityKey,
|
||||||
|
needsEmailVerification,
|
||||||
|
isLoading,
|
||||||
|
isSuccess,
|
||||||
|
isError,
|
||||||
|
error
|
||||||
|
} = useSignUpEmailSecurityKey()
|
||||||
|
|
||||||
|
console.log({ needsEmailVerification, isLoading, isSuccess, isError, error })
|
||||||
|
|
||||||
|
const handleFormSubmit = async (e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
|
||||||
|
await signUpEmailSecurityKey('joe@example.com')
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">options</span>** <span className="optional-status">optional</span> `SignUpSecurityKeyOptions`
|
||||||
|
|
||||||
|
---
|
||||||
@@ -4,7 +4,7 @@ title: NhostSession
|
|||||||
sidebar_label: NhostSession
|
sidebar_label: NhostSession
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/core/src/types.ts#L136
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/core/src/types.ts#L141
|
||||||
---
|
---
|
||||||
|
|
||||||
# `NhostSession`
|
# `NhostSession`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: SignInSecurityKeyPasswordlessHookResult
|
|||||||
sidebar_label: SignInSecurityKeyPasswordlessHookResult
|
sidebar_label: SignInSecurityKeyPasswordlessHookResult
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignInSecurityKeyEmail.ts#L14
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignInEmailSecurityKey.ts#L14
|
||||||
---
|
---
|
||||||
|
|
||||||
# `SignInSecurityKeyPasswordlessHookResult`
|
# `SignInSecurityKeyPasswordlessHookResult`
|
||||||
@@ -65,6 +65,6 @@ Access token (JWT)
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**<span className="parameter-name">signInSecurityKeyEmail</span>** <span className="optional-status">required</span> `SignInSecurityKeyPasswordlessHandler`
|
**<span className="parameter-name">signInEmailSecurityKey</span>** <span className="optional-status">required</span> `SignInSecurityKeyPasswordlessHandler`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
---
|
||||||
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
|
title: SignUpSecurityKeyHookResult
|
||||||
|
sidebar_label: SignUpSecurityKeyHookResult
|
||||||
|
description: No description provided.
|
||||||
|
displayed_sidebar: referenceSidebar
|
||||||
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignUpEmailSecurityKey.ts#L16
|
||||||
|
---
|
||||||
|
|
||||||
|
# `SignUpSecurityKeyHookResult`
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||||
|
|
||||||
|
**`@returns`**
|
||||||
|
|
||||||
|
`true` if an error occurred
|
||||||
|
|
||||||
|
**`@depreacted`**
|
||||||
|
|
||||||
|
use `!isSuccess` or `!!error` instead
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> `null` | `ErrorPayload`
|
||||||
|
|
||||||
|
Provides details about the error
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">isLoading</span>** <span className="optional-status">required</span> `boolean`
|
||||||
|
|
||||||
|
**`@returns`**
|
||||||
|
|
||||||
|
`true` when the action is executing, `false` when it finished its execution.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">isSuccess</span>** <span className="optional-status">required</span> `boolean`
|
||||||
|
|
||||||
|
Returns `true` if the action is successful.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">user</span>** <span className="optional-status">required</span> `null` | `User`
|
||||||
|
|
||||||
|
User information
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">accessToken</span>** <span className="optional-status">required</span> `null` | `string`
|
||||||
|
|
||||||
|
Access token (JWT)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">needsEmailVerification</span>** <span className="optional-status">required</span> `boolean`
|
||||||
|
|
||||||
|
**`@returns`**
|
||||||
|
|
||||||
|
`true` if an email is required to complete the action, and that a verification email has been sent to complete the action.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">signUpEmailSecurityKey</span>** <span className="optional-status">required</span> `SignUpSecurityKeyHandler`
|
||||||
|
|
||||||
|
Used for a new user to sign up with a security key. Returns a promise with the current context
|
||||||
|
|
||||||
|
---
|
||||||
@@ -1,31 +1,31 @@
|
|||||||
---
|
---
|
||||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
title: useSignInSecurityKeyEmail()
|
title: useSignInEmailSecurityKey()
|
||||||
sidebar_label: useSignInSecurityKeyEmail()
|
sidebar_label: useSignInEmailSecurityKey()
|
||||||
slug: /reference/react/use-sign-in-security-key-email
|
slug: /reference/react/use-sign-in-email-security-key
|
||||||
description: Use the hook `useSignInSecurityKeyEmail` to sign in a user using their email and a security key using the WebAuthn API.
|
description: Use the hook `useSignInEmailSecurityKey` to sign in a user using their email and a security key using the WebAuthn API.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignInSecurityKeyEmail.ts#L41
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignInEmailSecurityKey.ts#L41
|
||||||
---
|
---
|
||||||
|
|
||||||
# `useSignInSecurityKeyEmail()`
|
# `useSignInEmailSecurityKey()`
|
||||||
|
|
||||||
Use the hook `useSignInSecurityKeyEmail` to sign in a user using their email and a security key using the WebAuthn API.
|
Use the hook `useSignInEmailSecurityKey` to sign in a user using their email and a security key using the WebAuthn API.
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
const {
|
const {
|
||||||
signInSecurityKeyEmail,
|
signInEmailSecurityKey,
|
||||||
needsEmailVerification,
|
needsEmailVerification,
|
||||||
isLoading,
|
isLoading,
|
||||||
isSuccess,
|
isSuccess,
|
||||||
isError,
|
isError,
|
||||||
error
|
error
|
||||||
} = useSignInSecurityKeyEmail()
|
} = useSignInEmailSecurityKey()
|
||||||
|
|
||||||
console.log({ needsEmailVerification, isLoading, isSuccess, isError, error })
|
console.log({ needsEmailVerification, isLoading, isSuccess, isError, error })
|
||||||
|
|
||||||
const handleFormSubmit = async (e) => {
|
const handleFormSubmit = async (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
await signInSecurityKeyEmail('joe@example.com')
|
await signInEmailSecurityKey('joe@example.com')
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
---
|
||||||
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
|
title: useSignUpEmailSecurityKeyEmail()
|
||||||
|
sidebar_label: useSignUpEmailSecurityKeyEmail()
|
||||||
|
slug: /reference/react/use-sign-up-email-security-key-email
|
||||||
|
description: Use the hook `useSignUpEmailSecurityKey` to sign up a user with security key and an email using the WebAuthn API.
|
||||||
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignUpEmailSecurityKey.ts#L43
|
||||||
|
---
|
||||||
|
|
||||||
|
# `useSignUpEmailSecurityKeyEmail()`
|
||||||
|
|
||||||
|
Use the hook `useSignUpEmailSecurityKey` to sign up a user with security key and an email using the WebAuthn API.
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
const {
|
||||||
|
signUpEmailSecurityKey,
|
||||||
|
needsEmailVerification,
|
||||||
|
isLoading,
|
||||||
|
isSuccess,
|
||||||
|
isError,
|
||||||
|
error
|
||||||
|
} = useSignUpEmailSecurityKey()
|
||||||
|
|
||||||
|
console.log({ needsEmailVerification, isLoading, isSuccess, isError, error })
|
||||||
|
|
||||||
|
const handleFormSubmit = async (e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
|
||||||
|
await signUpEmailSecurityKey('joe@example.com')
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">options</span>** <span className="optional-status">optional</span> `SignUpSecurityKeyOptions`
|
||||||
|
|
||||||
|
---
|
||||||
@@ -4,7 +4,7 @@ title: SignInSecurityKeyPasswordlessHookResult
|
|||||||
sidebar_label: SignInSecurityKeyPasswordlessHookResult
|
sidebar_label: SignInSecurityKeyPasswordlessHookResult
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
displayed_sidebar: referenceSidebar
|
displayed_sidebar: referenceSidebar
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignInSecurityKeyEmail.ts#L14
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignInEmailSecurityKey.ts#L14
|
||||||
---
|
---
|
||||||
|
|
||||||
# `SignInSecurityKeyPasswordlessHookResult`
|
# `SignInSecurityKeyPasswordlessHookResult`
|
||||||
@@ -65,6 +65,6 @@ Access token (JWT)
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**<span className="parameter-name">signInSecurityKeyEmail</span>** <span className="optional-status">required</span> `SignInSecurityKeyPasswordlessHandler`
|
**<span className="parameter-name">signInEmailSecurityKey</span>** <span className="optional-status">required</span> `SignInSecurityKeyPasswordlessHandler`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
---
|
||||||
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
|
title: SignUpSecurityKeyHookResult
|
||||||
|
sidebar_label: SignUpSecurityKeyHookResult
|
||||||
|
description: No description provided.
|
||||||
|
displayed_sidebar: referenceSidebar
|
||||||
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignUpEmailSecurityKey.ts#L16
|
||||||
|
---
|
||||||
|
|
||||||
|
# `SignUpSecurityKeyHookResult`
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||||
|
|
||||||
|
**`@returns`**
|
||||||
|
|
||||||
|
`true` if an error occurred
|
||||||
|
|
||||||
|
**`@depreacted`**
|
||||||
|
|
||||||
|
use `!isSuccess` or `!!error` instead
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> `null` | `ErrorPayload`
|
||||||
|
|
||||||
|
Provides details about the error
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">isLoading</span>** <span className="optional-status">required</span> `boolean`
|
||||||
|
|
||||||
|
**`@returns`**
|
||||||
|
|
||||||
|
`true` when the action is executing, `false` when it finished its execution.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">isSuccess</span>** <span className="optional-status">required</span> `boolean`
|
||||||
|
|
||||||
|
Returns `true` if the action is successful.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">user</span>** <span className="optional-status">required</span> `null` | `User`
|
||||||
|
|
||||||
|
User information
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">accessToken</span>** <span className="optional-status">required</span> `null` | `string`
|
||||||
|
|
||||||
|
Access token (JWT)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">needsEmailVerification</span>** <span className="optional-status">required</span> `boolean`
|
||||||
|
|
||||||
|
**`@returns`**
|
||||||
|
|
||||||
|
`true` if an email is required to complete the action, and that a verification email has been sent to complete the action.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">signUpEmailSecurityKey</span>** <span className="optional-status">required</span> `SignUpSecurityKeyHandler`
|
||||||
|
|
||||||
|
Used for a new user to sign up with a security key. Returns a promise with the current context
|
||||||
|
|
||||||
|
---
|
||||||
BIN
docs/static/img/database/connection-info.png
vendored
Normal file
BIN
docs/static/img/database/connection-info.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 231 KiB |
BIN
docs/static/videos/enable-security-keys-sign-in.mp4
vendored
Normal file
BIN
docs/static/videos/enable-security-keys-sign-in.mp4
vendored
Normal file
Binary file not shown.
BIN
docs/static/videos/hasura-create-table.mp4
vendored
BIN
docs/static/videos/hasura-create-table.mp4
vendored
Binary file not shown.
BIN
docs/static/videos/hasura-delete-table.mp4
vendored
BIN
docs/static/videos/hasura-delete-table.mp4
vendored
Binary file not shown.
BIN
docs/static/videos/hasura-modify-table.mp4
vendored
BIN
docs/static/videos/hasura-modify-table.mp4
vendored
Binary file not shown.
BIN
docs/static/videos/nhost-database-reset-password.mp4
vendored
Normal file
BIN
docs/static/videos/nhost-database-reset-password.mp4
vendored
Normal file
Binary file not shown.
BIN
docs/static/videos/nhost-table-create.mp4
vendored
Normal file
BIN
docs/static/videos/nhost-table-create.mp4
vendored
Normal file
Binary file not shown.
BIN
docs/static/videos/nhost-table-delete.mp4
vendored
Normal file
BIN
docs/static/videos/nhost-table-delete.mp4
vendored
Normal file
Binary file not shown.
BIN
docs/static/videos/nhost-table-edit.mp4
vendored
Normal file
BIN
docs/static/videos/nhost-table-edit.mp4
vendored
Normal file
Binary file not shown.
@@ -5,7 +5,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
hasura_graphql_enable_remote_schema_permissions: false
|
hasura_graphql_enable_remote_schema_permissions: false
|
||||||
auth:
|
auth:
|
||||||
image: nhost/hasura-auth:0.11.0
|
image: nhost/hasura-auth:0.13.2
|
||||||
storage:
|
storage:
|
||||||
image: nhost/hasura-storage:0.2.4
|
image: nhost/hasura-storage:0.2.4
|
||||||
auth:
|
auth:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
hasura_graphql_enable_remote_schema_permissions: false
|
hasura_graphql_enable_remote_schema_permissions: false
|
||||||
auth:
|
auth:
|
||||||
image: nhost/hasura-auth:0.11.0
|
image: nhost/hasura-auth:0.13.2
|
||||||
storage:
|
storage:
|
||||||
image: nhost/hasura-storage:0.2.4
|
image: nhost/hasura-storage:0.2.4
|
||||||
auth:
|
auth:
|
||||||
|
|||||||
9
examples/docker-compose/functions/package.json
Normal file
9
examples/docker-compose/functions/package.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"name": "functions",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC"
|
||||||
|
}
|
||||||
11
examples/docker-compose/functions/tsconfig.json
Normal file
11
examples/docker-compose/functions/tsconfig.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"strictNullChecks": false
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
hasura_graphql_enable_remote_schema_permissions: false
|
hasura_graphql_enable_remote_schema_permissions: false
|
||||||
auth:
|
auth:
|
||||||
image: nhost/hasura-auth:0.11.0
|
image: nhost/hasura-auth:0.13.2
|
||||||
storage:
|
storage:
|
||||||
image: nhost/hasura-storage:0.2.4
|
image: nhost/hasura-storage:0.2.4
|
||||||
auth:
|
auth:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
hasura_graphql_enable_remote_schema_permissions: false
|
hasura_graphql_enable_remote_schema_permissions: false
|
||||||
auth:
|
auth:
|
||||||
image: nhost/hasura-auth:0.11.0
|
image: nhost/hasura-auth:0.13.2
|
||||||
storage:
|
storage:
|
||||||
image: nhost/hasura-storage:0.2.4
|
image: nhost/hasura-storage:0.2.4
|
||||||
auth:
|
auth:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
hasura_graphql_enable_remote_schema_permissions: false
|
hasura_graphql_enable_remote_schema_permissions: false
|
||||||
auth:
|
auth:
|
||||||
image: nhost/hasura-auth:0.11.0
|
image: nhost/hasura-auth:0.13.2
|
||||||
storage:
|
storage:
|
||||||
image: nhost/hasura-storage:0.2.4
|
image: nhost/hasura-storage:0.2.4
|
||||||
auth:
|
auth:
|
||||||
|
|||||||
34
examples/react-apollo/CHANGELOG.md
Normal file
34
examples/react-apollo/CHANGELOG.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# @nhost-examples/react-apollo
|
||||||
|
|
||||||
|
## 0.1.0
|
||||||
|
|
||||||
|
### Minor Changes
|
||||||
|
|
||||||
|
- 739a3c45: Sign up with an email and a security key.
|
||||||
|
|
||||||
|
Use the hook `useSignUpEmailSecurityKey` to sign up a user with security key and an email using the WebAuthn API.
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
const {
|
||||||
|
signUpEmailSecurityKey,
|
||||||
|
needsEmailVerification,
|
||||||
|
isLoading,
|
||||||
|
isSuccess,
|
||||||
|
isError,
|
||||||
|
error
|
||||||
|
} = useSignUpEmailSecurityKey()
|
||||||
|
|
||||||
|
console.log({ needsEmailVerification, isLoading, isSuccess, isError, error })
|
||||||
|
|
||||||
|
const handleFormSubmit = async (e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
await signUpEmailSecurityKey('joe@example.com')
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [739a3c45]
|
||||||
|
- Updated dependencies [74758f2c]
|
||||||
|
- @nhost/react@0.13.0
|
||||||
|
- @nhost/react-apollo@5.0.0
|
||||||
@@ -37,3 +37,4 @@ nhost dev
|
|||||||
```sh
|
```sh
|
||||||
pnpm run dev
|
pnpm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ context('Anonymous users', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should deanonymise with passwordless email', () => {
|
it('should deanonymise with a magic link', () => {
|
||||||
cy.fetchUserData()
|
cy.fetchUserData()
|
||||||
.its('id')
|
.its('id')
|
||||||
.then((id) => {
|
.then((id) => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { faker } from '@faker-js/faker'
|
import { faker } from '@faker-js/faker'
|
||||||
|
|
||||||
context('Sign up with passwordless email', () => {
|
context('Sign up with a magic link', () => {
|
||||||
it('should sign-up with passwordless email', () => {
|
it('should sign-up with a magic link', () => {
|
||||||
const email = faker.internet.email()
|
const email = faker.internet.email()
|
||||||
cy.signUpEmailPasswordless(email)
|
cy.signUpEmailPasswordless(email)
|
||||||
cy.contains('Verification email sent').should('be.visible')
|
cy.contains('Verification email sent').should('be.visible')
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ context('Sign in with email+password', () => {
|
|||||||
cy.contains('Verification email sent').should('be.visible')
|
cy.contains('Verification email sent').should('be.visible')
|
||||||
cy.confirmEmail(email)
|
cy.confirmEmail(email)
|
||||||
cy.signOut()
|
cy.signOut()
|
||||||
cy.contains('Log in to the Application').should('be.visible')
|
cy.contains('Sign in to the Application').should('be.visible')
|
||||||
cy.signInEmailPassword(email, password)
|
cy.signInEmailPassword(email, password)
|
||||||
|
|
||||||
cy.contains('You are authenticated')
|
cy.contains('You are authenticated')
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ context('Sign in with a refresh token', () => {
|
|||||||
cy.contains('Profile page')
|
cy.contains('Profile page')
|
||||||
cy.clearLocalStorage()
|
cy.clearLocalStorage()
|
||||||
cy.reload()
|
cy.reload()
|
||||||
cy.contains('Log in to the Application')
|
cy.contains('Sign in to the Application')
|
||||||
cy.visitPathWithRefreshToken('/profile')
|
cy.visitPathWithRefreshToken('/profile')
|
||||||
cy.contains('Profile page')
|
cy.contains('Profile page')
|
||||||
})
|
})
|
||||||
@@ -15,7 +15,7 @@ context('Sign in with a refresh token', () => {
|
|||||||
cy.disconnectBackend()
|
cy.disconnectBackend()
|
||||||
cy.clearLocalStorage()
|
cy.clearLocalStorage()
|
||||||
cy.reload()
|
cy.reload()
|
||||||
cy.contains('Log in to the Application')
|
cy.contains('Sign in to the Application')
|
||||||
cy.visitPathWithRefreshToken('/profile')
|
cy.visitPathWithRefreshToken('/profile')
|
||||||
cy.location('pathname').should('equal', '/sign-in')
|
cy.location('pathname').should('equal', '/sign-in')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ context('Sign out', () => {
|
|||||||
cy.goToProfilePage()
|
cy.goToProfilePage()
|
||||||
cy.contains('Profile page')
|
cy.contains('Profile page')
|
||||||
cy.signOut()
|
cy.signOut()
|
||||||
cy.contains('Log in to the Application')
|
cy.contains('Sign in to the Application')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ Cypress.Commands.add('signUpEmailPassword', (email, password) => {
|
|||||||
|
|
||||||
Cypress.Commands.add('signUpEmailPasswordless', (email) => {
|
Cypress.Commands.add('signUpEmailPasswordless', (email) => {
|
||||||
cy.visit('/sign-up')
|
cy.visit('/sign-up')
|
||||||
cy.findByRole('button', { name: /Continue with passwordless email/i }).click()
|
cy.findByRole('button', { name: /Continue with a magic link/i }).click()
|
||||||
cy.findByPlaceholderText('Email Address').type(email)
|
cy.findByPlaceholderText('Email Address').type(email)
|
||||||
cy.findByRole('button', { name: /Continue with email/i }).click()
|
cy.findByRole('button', { name: /Continue with email/i }).click()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
hasura_graphql_enable_remote_schema_permissions: false
|
hasura_graphql_enable_remote_schema_permissions: false
|
||||||
auth:
|
auth:
|
||||||
image: nhost/hasura-auth:0.11.0
|
image: nhost/hasura-auth:0.13.2
|
||||||
storage:
|
storage:
|
||||||
image: nhost/hasura-storage:0.2.4
|
image: nhost/hasura-storage:0.2.4
|
||||||
auth:
|
auth:
|
||||||
@@ -129,7 +129,7 @@ auth:
|
|||||||
issuer: nhost
|
issuer: nhost
|
||||||
webauthn:
|
webauthn:
|
||||||
enabled: true
|
enabled: true
|
||||||
rp_name: 'Nhost React Apollo Example'
|
rp_name: Nhost React Apollo Example
|
||||||
storage:
|
storage:
|
||||||
force_download_for_content_types: text/html,application/javascript
|
force_download_for_content_types: text/html,application/javascript
|
||||||
version: 3
|
version: 3
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
table:
|
table:
|
||||||
name: user_authenticators
|
name: user_security_keys
|
||||||
schema: auth
|
schema: auth
|
||||||
configuration:
|
configuration:
|
||||||
column_config:
|
column_config:
|
||||||
@@ -13,17 +13,17 @@ configuration:
|
|||||||
credential_id: credentialId
|
credential_id: credentialId
|
||||||
credential_public_key: credentialPublicKey
|
credential_public_key: credentialPublicKey
|
||||||
user_id: userId
|
user_id: userId
|
||||||
custom_name: authUserAuthenticators
|
custom_name: authUserSecurityKeys
|
||||||
custom_root_fields:
|
custom_root_fields:
|
||||||
delete: deleteAuthUserAuthenticators
|
delete: deleteAuthUserSecurityKeys
|
||||||
delete_by_pk: deleteAuthUserAuthenticator
|
delete_by_pk: deleteAuthUserSecurityKey
|
||||||
insert: insertAuthUserAuthenticators
|
insert: insertAuthUserSecurityKeys
|
||||||
insert_one: insertAuthUserAuthenticator
|
insert_one: insertAuthUserSecurityKey
|
||||||
select: authUserAuthenticators
|
select: authUserSecurityKeys
|
||||||
select_aggregate: authUserAuthenticatorsAggregate
|
select_aggregate: authUserSecurityKeysAggregate
|
||||||
select_by_pk: authUserAuthenticator
|
select_by_pk: authUserSecurityKey
|
||||||
update: updateAuthUserAuthenticators
|
update: updateAuthUserSecurityKeys
|
||||||
update_by_pk: updateAuthUserAuthenticator
|
update_by_pk: updateAuthUserSecurityKey
|
||||||
object_relationships:
|
object_relationships:
|
||||||
- name: user
|
- name: user
|
||||||
using:
|
using:
|
||||||
@@ -32,14 +32,12 @@ select_permissions:
|
|||||||
- role: user
|
- role: user
|
||||||
permission:
|
permission:
|
||||||
columns:
|
columns:
|
||||||
- counter
|
|
||||||
- id
|
- id
|
||||||
- nickname
|
- nickname
|
||||||
- user_id
|
- user_id
|
||||||
filter:
|
filter:
|
||||||
user_id:
|
user_id:
|
||||||
_eq: X-Hasura-User-Id
|
_eq: X-Hasura-User-Id
|
||||||
allow_aggregations: true
|
|
||||||
delete_permissions:
|
delete_permissions:
|
||||||
- role: user
|
- role: user
|
||||||
permission:
|
permission:
|
||||||
@@ -77,13 +77,6 @@ object_relationships:
|
|||||||
using:
|
using:
|
||||||
foreign_key_constraint_on: default_role
|
foreign_key_constraint_on: default_role
|
||||||
array_relationships:
|
array_relationships:
|
||||||
- name: authenticators
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: user_id
|
|
||||||
table:
|
|
||||||
name: user_authenticators
|
|
||||||
schema: auth
|
|
||||||
- name: refreshTokens
|
- name: refreshTokens
|
||||||
using:
|
using:
|
||||||
foreign_key_constraint_on:
|
foreign_key_constraint_on:
|
||||||
@@ -98,6 +91,13 @@ array_relationships:
|
|||||||
table:
|
table:
|
||||||
name: user_roles
|
name: user_roles
|
||||||
schema: auth
|
schema: auth
|
||||||
|
- name: securityKeys
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on:
|
||||||
|
column: user_id
|
||||||
|
table:
|
||||||
|
name: user_security_keys
|
||||||
|
schema: auth
|
||||||
- name: userProviders
|
- name: userProviders
|
||||||
using:
|
using:
|
||||||
foreign_key_constraint_on:
|
foreign_key_constraint_on:
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
- "!include auth_providers.yaml"
|
- "!include auth_providers.yaml"
|
||||||
- "!include auth_refresh_tokens.yaml"
|
- "!include auth_refresh_tokens.yaml"
|
||||||
- "!include auth_roles.yaml"
|
- "!include auth_roles.yaml"
|
||||||
- "!include auth_user_authenticators.yaml"
|
|
||||||
- "!include auth_user_providers.yaml"
|
- "!include auth_user_providers.yaml"
|
||||||
- "!include auth_user_roles.yaml"
|
- "!include auth_user_roles.yaml"
|
||||||
|
- "!include auth_user_security_keys.yaml"
|
||||||
- "!include auth_users.yaml"
|
- "!include auth_users.yaml"
|
||||||
- "!include public_todos.yaml"
|
- "!include public_todos.yaml"
|
||||||
- "!include storage_buckets.yaml"
|
- "!include storage_buckets.yaml"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost-examples/react-apollo",
|
"name": "@nhost-examples/react-apollo",
|
||||||
"version": "0.0.1",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apollo/client": "^3.6.9",
|
"@apollo/client": "^3.6.9",
|
||||||
|
|||||||
@@ -1,22 +1,19 @@
|
|||||||
import { useState } from 'react'
|
import { FormEvent, useState } from 'react'
|
||||||
import { useNavigate } from 'react-router-dom'
|
|
||||||
|
|
||||||
import { Button, Modal, SimpleGrid, TextInput } from '@mantine/core'
|
import { Button, Modal, SimpleGrid, TextInput } from '@mantine/core'
|
||||||
import { showNotification } from '@mantine/notifications'
|
import { showNotification } from '@mantine/notifications'
|
||||||
import { useSignInEmailPasswordless, useSignInSecurityKeyEmail } from '@nhost/react'
|
import { useSignInEmailPasswordless } from '@nhost/react'
|
||||||
|
|
||||||
export const SignUpPasswordlessForm: React.FC = () => {
|
export const SignUpPasswordlessForm: React.FC = () => {
|
||||||
const navigate = useNavigate()
|
|
||||||
|
|
||||||
const { signInEmailPasswordless } = useSignInEmailPasswordless({ redirectTo: '/profile' })
|
const { signInEmailPasswordless } = useSignInEmailPasswordless({ redirectTo: '/profile' })
|
||||||
const { signInSecurityKeyEmail } = useSignInSecurityKeyEmail()
|
|
||||||
|
|
||||||
const [emailVerificationToggle, setEmailVerificationToggle] = useState(false)
|
const [emailVerificationToggle, setEmailVerificationToggle] = useState(false)
|
||||||
const [emailNeedsVerificationToggle, setEmailNeedsVerificationToggle] = useState(false)
|
const [emailNeedsVerificationToggle, setEmailNeedsVerificationToggle] = useState(false)
|
||||||
|
|
||||||
const [email, setEmail] = useState('')
|
const [email, setEmail] = useState('')
|
||||||
|
|
||||||
const signInEmail = async () => {
|
const signInEmail = async (e: FormEvent<HTMLFormElement>) => {
|
||||||
|
e.preventDefault()
|
||||||
const result = await signInEmailPasswordless(email)
|
const result = await signInEmailPasswordless(email)
|
||||||
if (result.isError) {
|
if (result.isError) {
|
||||||
showNotification({
|
showNotification({
|
||||||
@@ -28,21 +25,6 @@ export const SignUpPasswordlessForm: React.FC = () => {
|
|||||||
setEmailVerificationToggle(true)
|
setEmailVerificationToggle(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const signInDevice = async () => {
|
|
||||||
const result = await signInSecurityKeyEmail(email)
|
|
||||||
if (result.needsEmailVerification) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (result.isError) {
|
|
||||||
showNotification({
|
|
||||||
color: 'red',
|
|
||||||
title: 'Error',
|
|
||||||
message: result.error?.message || null
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
navigate('/', { replace: true })
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<SimpleGrid cols={1} spacing={6}>
|
<SimpleGrid cols={1} spacing={6}>
|
||||||
<Modal
|
<Modal
|
||||||
@@ -70,18 +52,19 @@ export const SignUpPasswordlessForm: React.FC = () => {
|
|||||||
You need to verify your email first. Please check your mailbox and follow the confirmation
|
You need to verify your email first. Please check your mailbox and follow the confirmation
|
||||||
link to complete the registration.
|
link to complete the registration.
|
||||||
</Modal>
|
</Modal>
|
||||||
<TextInput
|
<form onSubmit={signInEmail}>
|
||||||
type="email"
|
<TextInput
|
||||||
placeholder="Email Address"
|
type="email"
|
||||||
value={email}
|
placeholder="Email Address"
|
||||||
onChange={(e) => setEmail(e.target.value)}
|
value={email}
|
||||||
/>
|
onChange={(e) => setEmail(e.target.value)}
|
||||||
<Button fullWidth onClick={signInDevice}>
|
autoFocus
|
||||||
Use a security key
|
style={{ marginBottom: '0.5em' }}
|
||||||
</Button>
|
/>
|
||||||
<Button fullWidth onClick={signInEmail}>
|
<Button fullWidth type="submit">
|
||||||
Send a magic link
|
Send a magic link
|
||||||
</Button>
|
</Button>
|
||||||
|
</form>
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ export type Scalars = {
|
|||||||
Boolean: boolean;
|
Boolean: boolean;
|
||||||
Int: number;
|
Int: number;
|
||||||
Float: number;
|
Float: number;
|
||||||
bigint: number;
|
|
||||||
citext: string;
|
citext: string;
|
||||||
jsonb: any;
|
jsonb: any;
|
||||||
timestamptz: string;
|
timestamptz: string;
|
||||||
@@ -76,10 +75,9 @@ export type StringComparisonExp = {
|
|||||||
_similar?: InputMaybe<Scalars['String']>;
|
_similar?: InputMaybe<Scalars['String']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** User webauthn authenticators. Don't modify its structure as Hasura Auth relies on it to function properly. */
|
/** User webauthn security keys. Don't modify its structure as Hasura Auth relies on it to function properly. */
|
||||||
export type AuthUserAuthenticators = {
|
export type AuthUserSecurityKeys = {
|
||||||
__typename?: 'authUserAuthenticators';
|
__typename?: 'authUserSecurityKeys';
|
||||||
counter: Scalars['bigint'];
|
|
||||||
id: Scalars['uuid'];
|
id: Scalars['uuid'];
|
||||||
nickname?: Maybe<Scalars['String']>;
|
nickname?: Maybe<Scalars['String']>;
|
||||||
/** An object relationship */
|
/** An object relationship */
|
||||||
@@ -87,130 +85,57 @@ export type AuthUserAuthenticators = {
|
|||||||
userId: Scalars['uuid'];
|
userId: Scalars['uuid'];
|
||||||
};
|
};
|
||||||
|
|
||||||
/** aggregated selection of "auth.user_authenticators" */
|
/** order by aggregate values of table "auth.user_security_keys" */
|
||||||
export type AuthUserAuthenticatorsAggregate = {
|
export type AuthUserSecurityKeysAggregateOrderBy = {
|
||||||
__typename?: 'authUserAuthenticators_aggregate';
|
|
||||||
aggregate?: Maybe<AuthUserAuthenticatorsAggregateFields>;
|
|
||||||
nodes: Array<AuthUserAuthenticators>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** aggregate fields of "auth.user_authenticators" */
|
|
||||||
export type AuthUserAuthenticatorsAggregateFields = {
|
|
||||||
__typename?: 'authUserAuthenticators_aggregate_fields';
|
|
||||||
avg?: Maybe<AuthUserAuthenticatorsAvgFields>;
|
|
||||||
count: Scalars['Int'];
|
|
||||||
max?: Maybe<AuthUserAuthenticatorsMaxFields>;
|
|
||||||
min?: Maybe<AuthUserAuthenticatorsMinFields>;
|
|
||||||
stddev?: Maybe<AuthUserAuthenticatorsStddevFields>;
|
|
||||||
stddev_pop?: Maybe<AuthUserAuthenticatorsStddevPopFields>;
|
|
||||||
stddev_samp?: Maybe<AuthUserAuthenticatorsStddevSampFields>;
|
|
||||||
sum?: Maybe<AuthUserAuthenticatorsSumFields>;
|
|
||||||
var_pop?: Maybe<AuthUserAuthenticatorsVarPopFields>;
|
|
||||||
var_samp?: Maybe<AuthUserAuthenticatorsVarSampFields>;
|
|
||||||
variance?: Maybe<AuthUserAuthenticatorsVarianceFields>;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/** aggregate fields of "auth.user_authenticators" */
|
|
||||||
export type AuthUserAuthenticatorsAggregateFieldsCountArgs = {
|
|
||||||
columns?: InputMaybe<Array<AuthUserAuthenticatorsSelectColumn>>;
|
|
||||||
distinct?: InputMaybe<Scalars['Boolean']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** order by aggregate values of table "auth.user_authenticators" */
|
|
||||||
export type AuthUserAuthenticatorsAggregateOrderBy = {
|
|
||||||
avg?: InputMaybe<AuthUserAuthenticatorsAvgOrderBy>;
|
|
||||||
count?: InputMaybe<OrderBy>;
|
count?: InputMaybe<OrderBy>;
|
||||||
max?: InputMaybe<AuthUserAuthenticatorsMaxOrderBy>;
|
max?: InputMaybe<AuthUserSecurityKeysMaxOrderBy>;
|
||||||
min?: InputMaybe<AuthUserAuthenticatorsMinOrderBy>;
|
min?: InputMaybe<AuthUserSecurityKeysMinOrderBy>;
|
||||||
stddev?: InputMaybe<AuthUserAuthenticatorsStddevOrderBy>;
|
|
||||||
stddev_pop?: InputMaybe<AuthUserAuthenticatorsStddevPopOrderBy>;
|
|
||||||
stddev_samp?: InputMaybe<AuthUserAuthenticatorsStddevSampOrderBy>;
|
|
||||||
sum?: InputMaybe<AuthUserAuthenticatorsSumOrderBy>;
|
|
||||||
var_pop?: InputMaybe<AuthUserAuthenticatorsVarPopOrderBy>;
|
|
||||||
var_samp?: InputMaybe<AuthUserAuthenticatorsVarSampOrderBy>;
|
|
||||||
variance?: InputMaybe<AuthUserAuthenticatorsVarianceOrderBy>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** aggregate avg on columns */
|
/** Boolean expression to filter rows from the table "auth.user_security_keys". All fields are combined with a logical 'AND'. */
|
||||||
export type AuthUserAuthenticatorsAvgFields = {
|
export type AuthUserSecurityKeysBoolExp = {
|
||||||
__typename?: 'authUserAuthenticators_avg_fields';
|
_and?: InputMaybe<Array<AuthUserSecurityKeysBoolExp>>;
|
||||||
counter?: Maybe<Scalars['Float']>;
|
_not?: InputMaybe<AuthUserSecurityKeysBoolExp>;
|
||||||
};
|
_or?: InputMaybe<Array<AuthUserSecurityKeysBoolExp>>;
|
||||||
|
|
||||||
/** order by avg() on columns of table "auth.user_authenticators" */
|
|
||||||
export type AuthUserAuthenticatorsAvgOrderBy = {
|
|
||||||
counter?: InputMaybe<OrderBy>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Boolean expression to filter rows from the table "auth.user_authenticators". All fields are combined with a logical 'AND'. */
|
|
||||||
export type AuthUserAuthenticatorsBoolExp = {
|
|
||||||
_and?: InputMaybe<Array<AuthUserAuthenticatorsBoolExp>>;
|
|
||||||
_not?: InputMaybe<AuthUserAuthenticatorsBoolExp>;
|
|
||||||
_or?: InputMaybe<Array<AuthUserAuthenticatorsBoolExp>>;
|
|
||||||
counter?: InputMaybe<BigintComparisonExp>;
|
|
||||||
id?: InputMaybe<UuidComparisonExp>;
|
id?: InputMaybe<UuidComparisonExp>;
|
||||||
nickname?: InputMaybe<StringComparisonExp>;
|
nickname?: InputMaybe<StringComparisonExp>;
|
||||||
user?: InputMaybe<UsersBoolExp>;
|
user?: InputMaybe<UsersBoolExp>;
|
||||||
userId?: InputMaybe<UuidComparisonExp>;
|
userId?: InputMaybe<UuidComparisonExp>;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** aggregate max on columns */
|
/** order by max() on columns of table "auth.user_security_keys" */
|
||||||
export type AuthUserAuthenticatorsMaxFields = {
|
export type AuthUserSecurityKeysMaxOrderBy = {
|
||||||
__typename?: 'authUserAuthenticators_max_fields';
|
|
||||||
counter?: Maybe<Scalars['bigint']>;
|
|
||||||
id?: Maybe<Scalars['uuid']>;
|
|
||||||
nickname?: Maybe<Scalars['String']>;
|
|
||||||
userId?: Maybe<Scalars['uuid']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** order by max() on columns of table "auth.user_authenticators" */
|
|
||||||
export type AuthUserAuthenticatorsMaxOrderBy = {
|
|
||||||
counter?: InputMaybe<OrderBy>;
|
|
||||||
id?: InputMaybe<OrderBy>;
|
id?: InputMaybe<OrderBy>;
|
||||||
nickname?: InputMaybe<OrderBy>;
|
nickname?: InputMaybe<OrderBy>;
|
||||||
userId?: InputMaybe<OrderBy>;
|
userId?: InputMaybe<OrderBy>;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** aggregate min on columns */
|
/** order by min() on columns of table "auth.user_security_keys" */
|
||||||
export type AuthUserAuthenticatorsMinFields = {
|
export type AuthUserSecurityKeysMinOrderBy = {
|
||||||
__typename?: 'authUserAuthenticators_min_fields';
|
|
||||||
counter?: Maybe<Scalars['bigint']>;
|
|
||||||
id?: Maybe<Scalars['uuid']>;
|
|
||||||
nickname?: Maybe<Scalars['String']>;
|
|
||||||
userId?: Maybe<Scalars['uuid']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** order by min() on columns of table "auth.user_authenticators" */
|
|
||||||
export type AuthUserAuthenticatorsMinOrderBy = {
|
|
||||||
counter?: InputMaybe<OrderBy>;
|
|
||||||
id?: InputMaybe<OrderBy>;
|
id?: InputMaybe<OrderBy>;
|
||||||
nickname?: InputMaybe<OrderBy>;
|
nickname?: InputMaybe<OrderBy>;
|
||||||
userId?: InputMaybe<OrderBy>;
|
userId?: InputMaybe<OrderBy>;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** response of any mutation on the table "auth.user_authenticators" */
|
/** response of any mutation on the table "auth.user_security_keys" */
|
||||||
export type AuthUserAuthenticatorsMutationResponse = {
|
export type AuthUserSecurityKeysMutationResponse = {
|
||||||
__typename?: 'authUserAuthenticators_mutation_response';
|
__typename?: 'authUserSecurityKeys_mutation_response';
|
||||||
/** number of rows affected by the mutation */
|
/** number of rows affected by the mutation */
|
||||||
affected_rows: Scalars['Int'];
|
affected_rows: Scalars['Int'];
|
||||||
/** data from the rows affected by the mutation */
|
/** data from the rows affected by the mutation */
|
||||||
returning: Array<AuthUserAuthenticators>;
|
returning: Array<AuthUserSecurityKeys>;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Ordering options when selecting data from "auth.user_authenticators". */
|
/** Ordering options when selecting data from "auth.user_security_keys". */
|
||||||
export type AuthUserAuthenticatorsOrderBy = {
|
export type AuthUserSecurityKeysOrderBy = {
|
||||||
counter?: InputMaybe<OrderBy>;
|
|
||||||
id?: InputMaybe<OrderBy>;
|
id?: InputMaybe<OrderBy>;
|
||||||
nickname?: InputMaybe<OrderBy>;
|
nickname?: InputMaybe<OrderBy>;
|
||||||
user?: InputMaybe<UsersOrderBy>;
|
user?: InputMaybe<UsersOrderBy>;
|
||||||
userId?: InputMaybe<OrderBy>;
|
userId?: InputMaybe<OrderBy>;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** select columns of table "auth.user_authenticators" */
|
/** select columns of table "auth.user_security_keys" */
|
||||||
export enum AuthUserAuthenticatorsSelectColumn {
|
export enum AuthUserSecurityKeysSelectColumn {
|
||||||
/** column name */
|
|
||||||
Counter = 'counter',
|
|
||||||
/** column name */
|
/** column name */
|
||||||
Id = 'id',
|
Id = 'id',
|
||||||
/** column name */
|
/** column name */
|
||||||
@@ -219,96 +144,6 @@ export enum AuthUserAuthenticatorsSelectColumn {
|
|||||||
UserId = 'userId'
|
UserId = 'userId'
|
||||||
}
|
}
|
||||||
|
|
||||||
/** aggregate stddev on columns */
|
|
||||||
export type AuthUserAuthenticatorsStddevFields = {
|
|
||||||
__typename?: 'authUserAuthenticators_stddev_fields';
|
|
||||||
counter?: Maybe<Scalars['Float']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** order by stddev() on columns of table "auth.user_authenticators" */
|
|
||||||
export type AuthUserAuthenticatorsStddevOrderBy = {
|
|
||||||
counter?: InputMaybe<OrderBy>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** aggregate stddev_pop on columns */
|
|
||||||
export type AuthUserAuthenticatorsStddevPopFields = {
|
|
||||||
__typename?: 'authUserAuthenticators_stddev_pop_fields';
|
|
||||||
counter?: Maybe<Scalars['Float']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** order by stddev_pop() on columns of table "auth.user_authenticators" */
|
|
||||||
export type AuthUserAuthenticatorsStddevPopOrderBy = {
|
|
||||||
counter?: InputMaybe<OrderBy>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** aggregate stddev_samp on columns */
|
|
||||||
export type AuthUserAuthenticatorsStddevSampFields = {
|
|
||||||
__typename?: 'authUserAuthenticators_stddev_samp_fields';
|
|
||||||
counter?: Maybe<Scalars['Float']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** order by stddev_samp() on columns of table "auth.user_authenticators" */
|
|
||||||
export type AuthUserAuthenticatorsStddevSampOrderBy = {
|
|
||||||
counter?: InputMaybe<OrderBy>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** aggregate sum on columns */
|
|
||||||
export type AuthUserAuthenticatorsSumFields = {
|
|
||||||
__typename?: 'authUserAuthenticators_sum_fields';
|
|
||||||
counter?: Maybe<Scalars['bigint']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** order by sum() on columns of table "auth.user_authenticators" */
|
|
||||||
export type AuthUserAuthenticatorsSumOrderBy = {
|
|
||||||
counter?: InputMaybe<OrderBy>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** aggregate var_pop on columns */
|
|
||||||
export type AuthUserAuthenticatorsVarPopFields = {
|
|
||||||
__typename?: 'authUserAuthenticators_var_pop_fields';
|
|
||||||
counter?: Maybe<Scalars['Float']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** order by var_pop() on columns of table "auth.user_authenticators" */
|
|
||||||
export type AuthUserAuthenticatorsVarPopOrderBy = {
|
|
||||||
counter?: InputMaybe<OrderBy>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** aggregate var_samp on columns */
|
|
||||||
export type AuthUserAuthenticatorsVarSampFields = {
|
|
||||||
__typename?: 'authUserAuthenticators_var_samp_fields';
|
|
||||||
counter?: Maybe<Scalars['Float']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** order by var_samp() on columns of table "auth.user_authenticators" */
|
|
||||||
export type AuthUserAuthenticatorsVarSampOrderBy = {
|
|
||||||
counter?: InputMaybe<OrderBy>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** aggregate variance on columns */
|
|
||||||
export type AuthUserAuthenticatorsVarianceFields = {
|
|
||||||
__typename?: 'authUserAuthenticators_variance_fields';
|
|
||||||
counter?: Maybe<Scalars['Float']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** order by variance() on columns of table "auth.user_authenticators" */
|
|
||||||
export type AuthUserAuthenticatorsVarianceOrderBy = {
|
|
||||||
counter?: InputMaybe<OrderBy>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Boolean expression to compare columns of type "bigint". All fields are combined with logical 'AND'. */
|
|
||||||
export type BigintComparisonExp = {
|
|
||||||
_eq?: InputMaybe<Scalars['bigint']>;
|
|
||||||
_gt?: InputMaybe<Scalars['bigint']>;
|
|
||||||
_gte?: InputMaybe<Scalars['bigint']>;
|
|
||||||
_in?: InputMaybe<Array<Scalars['bigint']>>;
|
|
||||||
_is_null?: InputMaybe<Scalars['Boolean']>;
|
|
||||||
_lt?: InputMaybe<Scalars['bigint']>;
|
|
||||||
_lte?: InputMaybe<Scalars['bigint']>;
|
|
||||||
_neq?: InputMaybe<Scalars['bigint']>;
|
|
||||||
_nin?: InputMaybe<Array<Scalars['bigint']>>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Boolean expression to compare columns of type "citext". All fields are combined with logical 'AND'. */
|
/** Boolean expression to compare columns of type "citext". All fields are combined with logical 'AND'. */
|
||||||
export type CitextComparisonExp = {
|
export type CitextComparisonExp = {
|
||||||
_eq?: InputMaybe<Scalars['citext']>;
|
_eq?: InputMaybe<Scalars['citext']>;
|
||||||
@@ -535,10 +370,10 @@ export type JsonbComparisonExp = {
|
|||||||
/** mutation root */
|
/** mutation root */
|
||||||
export type MutationRoot = {
|
export type MutationRoot = {
|
||||||
__typename?: 'mutation_root';
|
__typename?: 'mutation_root';
|
||||||
/** delete single row from the table: "auth.user_authenticators" */
|
/** delete single row from the table: "auth.user_security_keys" */
|
||||||
deleteAuthUserAuthenticator?: Maybe<AuthUserAuthenticators>;
|
deleteAuthUserSecurityKey?: Maybe<AuthUserSecurityKeys>;
|
||||||
/** delete data from the table: "auth.user_authenticators" */
|
/** delete data from the table: "auth.user_security_keys" */
|
||||||
deleteAuthUserAuthenticators?: Maybe<AuthUserAuthenticatorsMutationResponse>;
|
deleteAuthUserSecurityKeys?: Maybe<AuthUserSecurityKeysMutationResponse>;
|
||||||
/** delete single row from the table: "storage.files" */
|
/** delete single row from the table: "storage.files" */
|
||||||
deleteFile?: Maybe<Files>;
|
deleteFile?: Maybe<Files>;
|
||||||
/** delete data from the table: "storage.files" */
|
/** delete data from the table: "storage.files" */
|
||||||
@@ -571,14 +406,14 @@ export type MutationRoot = {
|
|||||||
|
|
||||||
|
|
||||||
/** mutation root */
|
/** mutation root */
|
||||||
export type MutationRootDeleteAuthUserAuthenticatorArgs = {
|
export type MutationRootDeleteAuthUserSecurityKeyArgs = {
|
||||||
id: Scalars['uuid'];
|
id: Scalars['uuid'];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** mutation root */
|
/** mutation root */
|
||||||
export type MutationRootDeleteAuthUserAuthenticatorsArgs = {
|
export type MutationRootDeleteAuthUserSecurityKeysArgs = {
|
||||||
where: AuthUserAuthenticatorsBoolExp;
|
where: AuthUserSecurityKeysBoolExp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -693,12 +528,10 @@ export enum OrderBy {
|
|||||||
|
|
||||||
export type QueryRoot = {
|
export type QueryRoot = {
|
||||||
__typename?: 'query_root';
|
__typename?: 'query_root';
|
||||||
/** fetch data from the table: "auth.user_authenticators" using primary key columns */
|
/** fetch data from the table: "auth.user_security_keys" using primary key columns */
|
||||||
authUserAuthenticator?: Maybe<AuthUserAuthenticators>;
|
authUserSecurityKey?: Maybe<AuthUserSecurityKeys>;
|
||||||
/** fetch data from the table: "auth.user_authenticators" */
|
/** fetch data from the table: "auth.user_security_keys" */
|
||||||
authUserAuthenticators: Array<AuthUserAuthenticators>;
|
authUserSecurityKeys: Array<AuthUserSecurityKeys>;
|
||||||
/** fetch aggregated fields from the table: "auth.user_authenticators" */
|
|
||||||
authUserAuthenticatorsAggregate: AuthUserAuthenticatorsAggregate;
|
|
||||||
/** fetch data from the table: "storage.files" using primary key columns */
|
/** fetch data from the table: "storage.files" using primary key columns */
|
||||||
file?: Maybe<Files>;
|
file?: Maybe<Files>;
|
||||||
/** fetch data from the table: "storage.files" */
|
/** fetch data from the table: "storage.files" */
|
||||||
@@ -716,26 +549,17 @@ export type QueryRoot = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export type QueryRootAuthUserAuthenticatorArgs = {
|
export type QueryRootAuthUserSecurityKeyArgs = {
|
||||||
id: Scalars['uuid'];
|
id: Scalars['uuid'];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export type QueryRootAuthUserAuthenticatorsArgs = {
|
export type QueryRootAuthUserSecurityKeysArgs = {
|
||||||
distinct_on?: InputMaybe<Array<AuthUserAuthenticatorsSelectColumn>>;
|
distinct_on?: InputMaybe<Array<AuthUserSecurityKeysSelectColumn>>;
|
||||||
limit?: InputMaybe<Scalars['Int']>;
|
limit?: InputMaybe<Scalars['Int']>;
|
||||||
offset?: InputMaybe<Scalars['Int']>;
|
offset?: InputMaybe<Scalars['Int']>;
|
||||||
order_by?: InputMaybe<Array<AuthUserAuthenticatorsOrderBy>>;
|
order_by?: InputMaybe<Array<AuthUserSecurityKeysOrderBy>>;
|
||||||
where?: InputMaybe<AuthUserAuthenticatorsBoolExp>;
|
where?: InputMaybe<AuthUserSecurityKeysBoolExp>;
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export type QueryRootAuthUserAuthenticatorsAggregateArgs = {
|
|
||||||
distinct_on?: InputMaybe<Array<AuthUserAuthenticatorsSelectColumn>>;
|
|
||||||
limit?: InputMaybe<Scalars['Int']>;
|
|
||||||
offset?: InputMaybe<Scalars['Int']>;
|
|
||||||
order_by?: InputMaybe<Array<AuthUserAuthenticatorsOrderBy>>;
|
|
||||||
where?: InputMaybe<AuthUserAuthenticatorsBoolExp>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -791,12 +615,10 @@ export type QueryRootUsersArgs = {
|
|||||||
|
|
||||||
export type SubscriptionRoot = {
|
export type SubscriptionRoot = {
|
||||||
__typename?: 'subscription_root';
|
__typename?: 'subscription_root';
|
||||||
/** fetch data from the table: "auth.user_authenticators" using primary key columns */
|
/** fetch data from the table: "auth.user_security_keys" using primary key columns */
|
||||||
authUserAuthenticator?: Maybe<AuthUserAuthenticators>;
|
authUserSecurityKey?: Maybe<AuthUserSecurityKeys>;
|
||||||
/** fetch data from the table: "auth.user_authenticators" */
|
/** fetch data from the table: "auth.user_security_keys" */
|
||||||
authUserAuthenticators: Array<AuthUserAuthenticators>;
|
authUserSecurityKeys: Array<AuthUserSecurityKeys>;
|
||||||
/** fetch aggregated fields from the table: "auth.user_authenticators" */
|
|
||||||
authUserAuthenticatorsAggregate: AuthUserAuthenticatorsAggregate;
|
|
||||||
/** fetch data from the table: "storage.files" using primary key columns */
|
/** fetch data from the table: "storage.files" using primary key columns */
|
||||||
file?: Maybe<Files>;
|
file?: Maybe<Files>;
|
||||||
/** fetch data from the table: "storage.files" */
|
/** fetch data from the table: "storage.files" */
|
||||||
@@ -814,26 +636,17 @@ export type SubscriptionRoot = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export type SubscriptionRootAuthUserAuthenticatorArgs = {
|
export type SubscriptionRootAuthUserSecurityKeyArgs = {
|
||||||
id: Scalars['uuid'];
|
id: Scalars['uuid'];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export type SubscriptionRootAuthUserAuthenticatorsArgs = {
|
export type SubscriptionRootAuthUserSecurityKeysArgs = {
|
||||||
distinct_on?: InputMaybe<Array<AuthUserAuthenticatorsSelectColumn>>;
|
distinct_on?: InputMaybe<Array<AuthUserSecurityKeysSelectColumn>>;
|
||||||
limit?: InputMaybe<Scalars['Int']>;
|
limit?: InputMaybe<Scalars['Int']>;
|
||||||
offset?: InputMaybe<Scalars['Int']>;
|
offset?: InputMaybe<Scalars['Int']>;
|
||||||
order_by?: InputMaybe<Array<AuthUserAuthenticatorsOrderBy>>;
|
order_by?: InputMaybe<Array<AuthUserSecurityKeysOrderBy>>;
|
||||||
where?: InputMaybe<AuthUserAuthenticatorsBoolExp>;
|
where?: InputMaybe<AuthUserSecurityKeysBoolExp>;
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export type SubscriptionRootAuthUserAuthenticatorsAggregateArgs = {
|
|
||||||
distinct_on?: InputMaybe<Array<AuthUserAuthenticatorsSelectColumn>>;
|
|
||||||
limit?: InputMaybe<Scalars['Int']>;
|
|
||||||
offset?: InputMaybe<Scalars['Int']>;
|
|
||||||
order_by?: InputMaybe<Array<AuthUserAuthenticatorsOrderBy>>;
|
|
||||||
where?: InputMaybe<AuthUserAuthenticatorsBoolExp>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1045,10 +858,6 @@ export type TodosUpdates = {
|
|||||||
export type Users = {
|
export type Users = {
|
||||||
__typename?: 'users';
|
__typename?: 'users';
|
||||||
activeMfaType?: Maybe<Scalars['String']>;
|
activeMfaType?: Maybe<Scalars['String']>;
|
||||||
/** An array relationship */
|
|
||||||
authenticators: Array<AuthUserAuthenticators>;
|
|
||||||
/** An aggregate relationship */
|
|
||||||
authenticators_aggregate: AuthUserAuthenticatorsAggregate;
|
|
||||||
avatarUrl: Scalars['String'];
|
avatarUrl: Scalars['String'];
|
||||||
createdAt: Scalars['timestamptz'];
|
createdAt: Scalars['timestamptz'];
|
||||||
currentChallenge?: Maybe<Scalars['String']>;
|
currentChallenge?: Maybe<Scalars['String']>;
|
||||||
@@ -1066,42 +875,33 @@ export type Users = {
|
|||||||
otpMethodLastUsed?: Maybe<Scalars['String']>;
|
otpMethodLastUsed?: Maybe<Scalars['String']>;
|
||||||
phoneNumber?: Maybe<Scalars['String']>;
|
phoneNumber?: Maybe<Scalars['String']>;
|
||||||
phoneNumberVerified: Scalars['Boolean'];
|
phoneNumberVerified: Scalars['Boolean'];
|
||||||
|
/** An array relationship */
|
||||||
|
securityKeys: Array<AuthUserSecurityKeys>;
|
||||||
updatedAt: Scalars['timestamptz'];
|
updatedAt: Scalars['timestamptz'];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** User account information. Don't modify its structure as Hasura Auth relies on it to function properly. */
|
|
||||||
export type UsersAuthenticatorsArgs = {
|
|
||||||
distinct_on?: InputMaybe<Array<AuthUserAuthenticatorsSelectColumn>>;
|
|
||||||
limit?: InputMaybe<Scalars['Int']>;
|
|
||||||
offset?: InputMaybe<Scalars['Int']>;
|
|
||||||
order_by?: InputMaybe<Array<AuthUserAuthenticatorsOrderBy>>;
|
|
||||||
where?: InputMaybe<AuthUserAuthenticatorsBoolExp>;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/** User account information. Don't modify its structure as Hasura Auth relies on it to function properly. */
|
|
||||||
export type UsersAuthenticatorsAggregateArgs = {
|
|
||||||
distinct_on?: InputMaybe<Array<AuthUserAuthenticatorsSelectColumn>>;
|
|
||||||
limit?: InputMaybe<Scalars['Int']>;
|
|
||||||
offset?: InputMaybe<Scalars['Int']>;
|
|
||||||
order_by?: InputMaybe<Array<AuthUserAuthenticatorsOrderBy>>;
|
|
||||||
where?: InputMaybe<AuthUserAuthenticatorsBoolExp>;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/** User account information. Don't modify its structure as Hasura Auth relies on it to function properly. */
|
/** User account information. Don't modify its structure as Hasura Auth relies on it to function properly. */
|
||||||
export type UsersMetadataArgs = {
|
export type UsersMetadataArgs = {
|
||||||
path?: InputMaybe<Scalars['String']>;
|
path?: InputMaybe<Scalars['String']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/** User account information. Don't modify its structure as Hasura Auth relies on it to function properly. */
|
||||||
|
export type UsersSecurityKeysArgs = {
|
||||||
|
distinct_on?: InputMaybe<Array<AuthUserSecurityKeysSelectColumn>>;
|
||||||
|
limit?: InputMaybe<Scalars['Int']>;
|
||||||
|
offset?: InputMaybe<Scalars['Int']>;
|
||||||
|
order_by?: InputMaybe<Array<AuthUserSecurityKeysOrderBy>>;
|
||||||
|
where?: InputMaybe<AuthUserSecurityKeysBoolExp>;
|
||||||
|
};
|
||||||
|
|
||||||
/** Boolean expression to filter rows from the table "auth.users". All fields are combined with a logical 'AND'. */
|
/** Boolean expression to filter rows from the table "auth.users". All fields are combined with a logical 'AND'. */
|
||||||
export type UsersBoolExp = {
|
export type UsersBoolExp = {
|
||||||
_and?: InputMaybe<Array<UsersBoolExp>>;
|
_and?: InputMaybe<Array<UsersBoolExp>>;
|
||||||
_not?: InputMaybe<UsersBoolExp>;
|
_not?: InputMaybe<UsersBoolExp>;
|
||||||
_or?: InputMaybe<Array<UsersBoolExp>>;
|
_or?: InputMaybe<Array<UsersBoolExp>>;
|
||||||
activeMfaType?: InputMaybe<StringComparisonExp>;
|
activeMfaType?: InputMaybe<StringComparisonExp>;
|
||||||
authenticators?: InputMaybe<AuthUserAuthenticatorsBoolExp>;
|
|
||||||
avatarUrl?: InputMaybe<StringComparisonExp>;
|
avatarUrl?: InputMaybe<StringComparisonExp>;
|
||||||
createdAt?: InputMaybe<TimestamptzComparisonExp>;
|
createdAt?: InputMaybe<TimestamptzComparisonExp>;
|
||||||
currentChallenge?: InputMaybe<StringComparisonExp>;
|
currentChallenge?: InputMaybe<StringComparisonExp>;
|
||||||
@@ -1119,13 +919,13 @@ export type UsersBoolExp = {
|
|||||||
otpMethodLastUsed?: InputMaybe<StringComparisonExp>;
|
otpMethodLastUsed?: InputMaybe<StringComparisonExp>;
|
||||||
phoneNumber?: InputMaybe<StringComparisonExp>;
|
phoneNumber?: InputMaybe<StringComparisonExp>;
|
||||||
phoneNumberVerified?: InputMaybe<BooleanComparisonExp>;
|
phoneNumberVerified?: InputMaybe<BooleanComparisonExp>;
|
||||||
|
securityKeys?: InputMaybe<AuthUserSecurityKeysBoolExp>;
|
||||||
updatedAt?: InputMaybe<TimestamptzComparisonExp>;
|
updatedAt?: InputMaybe<TimestamptzComparisonExp>;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Ordering options when selecting data from "auth.users". */
|
/** Ordering options when selecting data from "auth.users". */
|
||||||
export type UsersOrderBy = {
|
export type UsersOrderBy = {
|
||||||
activeMfaType?: InputMaybe<OrderBy>;
|
activeMfaType?: InputMaybe<OrderBy>;
|
||||||
authenticators_aggregate?: InputMaybe<AuthUserAuthenticatorsAggregateOrderBy>;
|
|
||||||
avatarUrl?: InputMaybe<OrderBy>;
|
avatarUrl?: InputMaybe<OrderBy>;
|
||||||
createdAt?: InputMaybe<OrderBy>;
|
createdAt?: InputMaybe<OrderBy>;
|
||||||
currentChallenge?: InputMaybe<OrderBy>;
|
currentChallenge?: InputMaybe<OrderBy>;
|
||||||
@@ -1143,6 +943,7 @@ export type UsersOrderBy = {
|
|||||||
otpMethodLastUsed?: InputMaybe<OrderBy>;
|
otpMethodLastUsed?: InputMaybe<OrderBy>;
|
||||||
phoneNumber?: InputMaybe<OrderBy>;
|
phoneNumber?: InputMaybe<OrderBy>;
|
||||||
phoneNumberVerified?: InputMaybe<OrderBy>;
|
phoneNumberVerified?: InputMaybe<OrderBy>;
|
||||||
|
securityKeys_aggregate?: InputMaybe<AuthUserSecurityKeysAggregateOrderBy>;
|
||||||
updatedAt?: InputMaybe<OrderBy>;
|
updatedAt?: InputMaybe<OrderBy>;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1220,11 +1021,11 @@ export type SecurityKeysQueryVariables = Exact<{
|
|||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type SecurityKeysQuery = { __typename?: 'query_root', authUserAuthenticators: Array<{ __typename?: 'authUserAuthenticators', id: string, nickname?: string | null }> };
|
export type SecurityKeysQuery = { __typename?: 'query_root', authUserSecurityKeys: Array<{ __typename?: 'authUserSecurityKeys', id: string, nickname?: string | null }> };
|
||||||
|
|
||||||
export type RemoveSecurityKeyMutationVariables = Exact<{
|
export type RemoveSecurityKeyMutationVariables = Exact<{
|
||||||
id: Scalars['uuid'];
|
id: Scalars['uuid'];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type RemoveSecurityKeyMutation = { __typename?: 'mutation_root', deleteAuthUserAuthenticator?: { __typename?: 'authUserAuthenticators', id: string } | null };
|
export type RemoveSecurityKeyMutation = { __typename?: 'mutation_root', deleteAuthUserSecurityKey?: { __typename?: 'authUserSecurityKeys', id: string } | null };
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { useAuthQuery } from '@nhost/react-apollo'
|
|||||||
|
|
||||||
const SECURITY_KEYS_LIST = gql`
|
const SECURITY_KEYS_LIST = gql`
|
||||||
query securityKeys($userId: uuid!) {
|
query securityKeys($userId: uuid!) {
|
||||||
authUserAuthenticators(where: { userId: { _eq: $userId } }) {
|
authUserSecurityKeys(where: { userId: { _eq: $userId } }) {
|
||||||
id
|
id
|
||||||
nickname
|
nickname
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,7 @@ const SECURITY_KEYS_LIST = gql`
|
|||||||
|
|
||||||
const REMOVE_SECURITY_KEY = gql`
|
const REMOVE_SECURITY_KEY = gql`
|
||||||
mutation removeSecurityKey($id: uuid!) {
|
mutation removeSecurityKey($id: uuid!) {
|
||||||
deleteAuthUserAuthenticator(id: $id) {
|
deleteAuthUserSecurityKey(id: $id) {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,13 +28,14 @@ const REMOVE_SECURITY_KEY = gql`
|
|||||||
export const SecurityKeys: React.FC = () => {
|
export const SecurityKeys: React.FC = () => {
|
||||||
const { add } = useAddSecurityKey()
|
const { add } = useAddSecurityKey()
|
||||||
const userId = useUserId()
|
const userId = useUserId()
|
||||||
|
// Nickname of the security key
|
||||||
const [nickname, setNickname] = useInputState('')
|
const [nickname, setNickname] = useInputState('')
|
||||||
const [list, setList] = useState<{ id: string; nickname?: string | null }[]>([])
|
const [list, setList] = useState<{ id: string; nickname?: string | null }[]>([])
|
||||||
useAuthQuery<SecurityKeysQuery>(SECURITY_KEYS_LIST, {
|
useAuthQuery<SecurityKeysQuery>(SECURITY_KEYS_LIST, {
|
||||||
variables: { userId },
|
variables: { userId },
|
||||||
onCompleted: ({ authUserAuthenticators }) => {
|
onCompleted: ({ authUserSecurityKeys }) => {
|
||||||
if (authUserAuthenticators) {
|
if (authUserSecurityKeys) {
|
||||||
setList(authUserAuthenticators || [])
|
setList(authUserSecurityKeys || [])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -52,9 +53,9 @@ export const SecurityKeys: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const [removeKey] = useMutation<RemoveSecurityKeyMutation>(REMOVE_SECURITY_KEY, {
|
const [removeKey] = useMutation<RemoveSecurityKeyMutation>(REMOVE_SECURITY_KEY, {
|
||||||
onCompleted: ({ deleteAuthUserAuthenticator }) => {
|
onCompleted: ({ deleteAuthUserSecurityKey }) => {
|
||||||
if (deleteAuthUserAuthenticator?.id) {
|
if (deleteAuthUserSecurityKey?.id) {
|
||||||
setList(list.filter((item) => item.id !== deleteAuthUserAuthenticator.id))
|
setList(list.filter((item) => item.id !== deleteAuthUserSecurityKey.id))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
|
|
||||||
import { Button, Modal, TextInput } from '@mantine/core'
|
import { Button, Divider, Modal, TextInput } from '@mantine/core'
|
||||||
import { showNotification } from '@mantine/notifications'
|
import { showNotification } from '@mantine/notifications'
|
||||||
import { useSignInEmailPassword, useSignInSecurityKeyEmail } from '@nhost/react'
|
import { useSignInEmailPassword } from '@nhost/react'
|
||||||
|
|
||||||
import AuthLink from '../components/AuthLink'
|
import AuthLink from '../components/AuthLink'
|
||||||
|
|
||||||
export const EmailPassword: React.FC = () => {
|
export const EmailPassword: React.FC = () => {
|
||||||
const { signInSecurityKeyEmail } = useSignInSecurityKeyEmail()
|
|
||||||
const [email, setEmail] = useState('')
|
const [email, setEmail] = useState('')
|
||||||
const [password, setPassword] = useState('')
|
const [password, setPassword] = useState('')
|
||||||
const [otp, setOtp] = useState('')
|
const [otp, setOtp] = useState('')
|
||||||
@@ -79,7 +78,6 @@ export const EmailPassword: React.FC = () => {
|
|||||||
value={email}
|
value={email}
|
||||||
onChange={(e) => setEmail(e.target.value)}
|
onChange={(e) => setEmail(e.target.value)}
|
||||||
placeholder="Email Address"
|
placeholder="Email Address"
|
||||||
size="lg"
|
|
||||||
autoFocus
|
autoFocus
|
||||||
style={{ marginBottom: '0.5em' }}
|
style={{ marginBottom: '0.5em' }}
|
||||||
/>
|
/>
|
||||||
@@ -88,29 +86,18 @@ export const EmailPassword: React.FC = () => {
|
|||||||
onChange={(e) => setPassword(e.target.value)}
|
onChange={(e) => setPassword(e.target.value)}
|
||||||
placeholder="Password"
|
placeholder="Password"
|
||||||
type="password"
|
type="password"
|
||||||
size="lg"
|
|
||||||
style={{ marginBottom: '0.5em' }}
|
style={{ marginBottom: '0.5em' }}
|
||||||
/>
|
/>
|
||||||
<Button
|
|
||||||
fullWidth
|
|
||||||
onClick={() => {
|
|
||||||
signInSecurityKeyEmail(email)
|
|
||||||
.then((res) => {
|
|
||||||
console.log(res)
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.log('bummer', err)
|
|
||||||
})
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
SecurityKey
|
|
||||||
</Button>
|
|
||||||
<Button fullWidth onClick={signIn}>
|
<Button fullWidth onClick={signIn}>
|
||||||
Sign in
|
Sign in
|
||||||
</Button>
|
</Button>
|
||||||
<AuthLink link="/sign-in/forgot-password" variant="white">
|
<AuthLink link="/sign-in/forgot-password" variant="white">
|
||||||
Forgot password?
|
Forgot password?
|
||||||
</AuthLink>
|
</AuthLink>
|
||||||
|
<Divider />
|
||||||
|
<AuthLink link="/sign-in" variant="white">
|
||||||
|
← Other Sign-in Options
|
||||||
|
</AuthLink>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ export const EmailPasswordless: React.FC = () => {
|
|||||||
<>
|
<>
|
||||||
<PasswordlessForm />
|
<PasswordlessForm />
|
||||||
<Divider />
|
<Divider />
|
||||||
<AuthLink link="/sign-up" variant="white">
|
<AuthLink link="/sign-in" variant="white">
|
||||||
← Other Login Options
|
← Other Sign-in Options
|
||||||
</AuthLink>
|
</AuthLink>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { FaLock } from 'react-icons/fa'
|
import { FaFingerprint, FaLock } from 'react-icons/fa'
|
||||||
import { Link, Route, Routes, useNavigate } from 'react-router-dom'
|
import { Link, Route, Routes, useNavigate } from 'react-router-dom'
|
||||||
|
|
||||||
import { Anchor, Center, Divider, Text } from '@mantine/core'
|
import { Anchor, Center, Divider, Text } from '@mantine/core'
|
||||||
@@ -11,13 +11,17 @@ import OAuthLinks from '../components/OauthLinks'
|
|||||||
import { EmailPassword } from './email-password'
|
import { EmailPassword } from './email-password'
|
||||||
import { EmailPasswordless } from './email-passwordless'
|
import { EmailPasswordless } from './email-passwordless'
|
||||||
import { ForgotPassword } from './forgot-password'
|
import { ForgotPassword } from './forgot-password'
|
||||||
|
import { SecurityKeySignIn } from './security-key'
|
||||||
|
|
||||||
const Index: React.FC = () => (
|
const Index: React.FC = () => (
|
||||||
<>
|
<>
|
||||||
<OAuthLinks />
|
<OAuthLinks />
|
||||||
<Divider my="sm" />
|
<Divider my="sm" />
|
||||||
|
<AuthLink leftIcon={<FaFingerprint />} variant="outline" link="/sign-in/security-key">
|
||||||
|
Continue with a security key
|
||||||
|
</AuthLink>
|
||||||
<AuthLink leftIcon={<FaLock />} variant="outline" link="/sign-in/email-passwordless">
|
<AuthLink leftIcon={<FaLock />} variant="outline" link="/sign-in/email-passwordless">
|
||||||
Continue passwordless
|
Continue with a magic link
|
||||||
</AuthLink>
|
</AuthLink>
|
||||||
<AuthLink variant="subtle" link="/sign-in/email-password">
|
<AuthLink variant="subtle" link="/sign-in/email-password">
|
||||||
Continue with email + password
|
Continue with email + password
|
||||||
@@ -36,7 +40,7 @@ export const SignInPage: React.FC = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<AuthLayout
|
<AuthLayout
|
||||||
title="Log in to the Application"
|
title="Sign in to the Application"
|
||||||
footer={
|
footer={
|
||||||
<Center>
|
<Center>
|
||||||
<Text>
|
<Text>
|
||||||
@@ -57,6 +61,7 @@ export const SignInPage: React.FC = () => {
|
|||||||
<Route path="/email-password" element={<EmailPassword />} />
|
<Route path="/email-password" element={<EmailPassword />} />
|
||||||
<Route path="/forgot-password" element={<ForgotPassword />} />
|
<Route path="/forgot-password" element={<ForgotPassword />} />
|
||||||
<Route path="/email-passwordless" element={<EmailPasswordless />} />
|
<Route path="/email-passwordless" element={<EmailPasswordless />} />
|
||||||
|
<Route path="/security-key" element={<SecurityKeySignIn />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</AuthLayout>
|
</AuthLayout>
|
||||||
)
|
)
|
||||||
|
|||||||
67
examples/react-apollo/src/sign-in/security-key.tsx
Normal file
67
examples/react-apollo/src/sign-in/security-key.tsx
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
import { FormEvent, useState } from 'react'
|
||||||
|
import { useNavigate } from 'react-router-dom'
|
||||||
|
|
||||||
|
import { Button, Divider, Modal, SimpleGrid, TextInput } from '@mantine/core'
|
||||||
|
import { showNotification } from '@mantine/notifications'
|
||||||
|
import { useSignInEmailSecurityKey } from '@nhost/react'
|
||||||
|
|
||||||
|
import AuthLink from '../components/AuthLink'
|
||||||
|
|
||||||
|
export const SecurityKeySignIn: React.FC = () => {
|
||||||
|
const { signInEmailSecurityKey } = useSignInEmailSecurityKey()
|
||||||
|
const [email, setEmail] = useState('')
|
||||||
|
const navigate = useNavigate()
|
||||||
|
const [emailVerificationToggle, setEmailVerificationToggle] = useState(false)
|
||||||
|
|
||||||
|
const signIn = async (e: FormEvent<HTMLFormElement>) => {
|
||||||
|
e.preventDefault()
|
||||||
|
const { isError, isSuccess, needsEmailVerification, error } = await signInEmailSecurityKey(
|
||||||
|
email
|
||||||
|
)
|
||||||
|
if (isError) {
|
||||||
|
showNotification({
|
||||||
|
color: 'red',
|
||||||
|
title: 'Error',
|
||||||
|
message: error?.message
|
||||||
|
})
|
||||||
|
} else if (needsEmailVerification) {
|
||||||
|
setEmailVerificationToggle(true)
|
||||||
|
} else if (isSuccess) {
|
||||||
|
navigate('/', { replace: true })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SimpleGrid cols={1} spacing={6}>
|
||||||
|
<Modal
|
||||||
|
title="Awaiting email verification"
|
||||||
|
transition="fade"
|
||||||
|
centered
|
||||||
|
transitionDuration={600}
|
||||||
|
opened={emailVerificationToggle}
|
||||||
|
onClose={() => {
|
||||||
|
setEmailVerificationToggle(false)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
You need to verify your email first. Please check your mailbox and follow the confirmation
|
||||||
|
link to complete the registration.
|
||||||
|
</Modal>
|
||||||
|
<form onSubmit={signIn}>
|
||||||
|
<TextInput
|
||||||
|
value={email}
|
||||||
|
onChange={(e) => setEmail(e.target.value)}
|
||||||
|
placeholder="Email Address"
|
||||||
|
autoFocus
|
||||||
|
style={{ marginBottom: '0.5em' }}
|
||||||
|
/>
|
||||||
|
<Button fullWidth type="submit">
|
||||||
|
Sign in with a security key
|
||||||
|
</Button>
|
||||||
|
</form>
|
||||||
|
<Divider />
|
||||||
|
<AuthLink link="/sign-in" variant="white">
|
||||||
|
← Other Sign-in Options
|
||||||
|
</AuthLink>
|
||||||
|
</SimpleGrid>
|
||||||
|
)
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user