Compare commits
86 Commits
@nhost/rea
...
@nhost/rea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
@@ -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.
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
---
|
||||||
@@ -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.0
|
||||||
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.0
|
||||||
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.0
|
||||||
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.0
|
||||||
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.0
|
||||||
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.0
|
||||||
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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,12 +3,11 @@ import { useNavigate } from 'react-router-dom'
|
|||||||
|
|
||||||
import { Button, Modal, TextInput } from '@mantine/core'
|
import { Button, 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('')
|
||||||
@@ -91,20 +90,6 @@ export const EmailPassword: React.FC = () => {
|
|||||||
size="lg"
|
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>
|
||||||
|
|||||||
@@ -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>
|
||||||
)
|
)
|
||||||
|
|||||||
61
examples/react-apollo/src/sign-in/security-key.tsx
Normal file
61
examples/react-apollo/src/sign-in/security-key.tsx
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
import { FormEvent, useState } from 'react'
|
||||||
|
import { useNavigate } from 'react-router-dom'
|
||||||
|
|
||||||
|
import { Button, Modal, SimpleGrid, TextInput } from '@mantine/core'
|
||||||
|
import { showNotification } from '@mantine/notifications'
|
||||||
|
import { useSignInEmailSecurityKey } from '@nhost/react'
|
||||||
|
|
||||||
|
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>
|
||||||
|
</SimpleGrid>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
import { useState } from 'react'
|
|
||||||
import { useNavigate } from 'react-router-dom'
|
|
||||||
|
|
||||||
import { Button, Modal, TextInput } from '@mantine/core'
|
|
||||||
import { showNotification } from '@mantine/notifications'
|
|
||||||
import { useSignInSecurityKeyEmail } from '@nhost/react'
|
|
||||||
|
|
||||||
import AuthLink from '../components/AuthLink'
|
|
||||||
|
|
||||||
export const EmailPassword: React.FC = () => {
|
|
||||||
const { signInSecurityKeyEmail } = useSignInSecurityKeyEmail()
|
|
||||||
const [email, setEmail] = useState('')
|
|
||||||
const navigate = useNavigate()
|
|
||||||
const [emailVerificationToggle, setEmailVerificationToggle] = useState(false)
|
|
||||||
|
|
||||||
const signIn = async () => {
|
|
||||||
const result = await signInSecurityKeyEmail(email)
|
|
||||||
if (result.isError) {
|
|
||||||
showNotification({
|
|
||||||
color: 'red',
|
|
||||||
title: 'Error',
|
|
||||||
message: result.error?.message
|
|
||||||
})
|
|
||||||
} else if (result.needsEmailVerification) {
|
|
||||||
setEmailVerificationToggle(true)
|
|
||||||
} else if (result.isSuccess) {
|
|
||||||
navigate('/', { replace: true })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<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>
|
|
||||||
<TextInput
|
|
||||||
value={email}
|
|
||||||
onChange={(e) => setEmail(e.target.value)}
|
|
||||||
placeholder="Email Address"
|
|
||||||
size="lg"
|
|
||||||
autoFocus
|
|
||||||
style={{ marginBottom: '0.5em' }}
|
|
||||||
/>
|
|
||||||
<Button fullWidth onClick={signIn}>
|
|
||||||
Sign in
|
|
||||||
</Button>
|
|
||||||
<AuthLink link="/sign-in/forgot-password" variant="white">
|
|
||||||
Forgot password?
|
|
||||||
</AuthLink>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { FaLock } from 'react-icons/fa'
|
import { FaFingerprint, FaLock } from 'react-icons/fa'
|
||||||
import { Link, Route, Routes } from 'react-router-dom'
|
import { Link, Route, Routes } from 'react-router-dom'
|
||||||
|
|
||||||
import { Anchor, Center, Divider, Text } from '@mantine/core'
|
import { Anchor, Center, Divider, Text } from '@mantine/core'
|
||||||
@@ -10,6 +10,7 @@ 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 { SecurityKeySignUp } from './security-key'
|
||||||
|
|
||||||
const Index: React.FC = () => {
|
const Index: React.FC = () => {
|
||||||
const isAnonymous = useUserIsAnonymous()
|
const isAnonymous = useUserIsAnonymous()
|
||||||
@@ -21,8 +22,11 @@ const Index: React.FC = () => {
|
|||||||
<Divider my="sm" />
|
<Divider my="sm" />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
<AuthLink leftIcon={<FaFingerprint />} variant="outline" link="/sign-up/security-key">
|
||||||
|
Continue with a security key
|
||||||
|
</AuthLink>
|
||||||
<AuthLink leftIcon={<FaLock />} variant="outline" link="/sign-up/email-passwordless">
|
<AuthLink leftIcon={<FaLock />} variant="outline" link="/sign-up/email-passwordless">
|
||||||
Continue with passwordless email
|
Continue with a magic link
|
||||||
</AuthLink>
|
</AuthLink>
|
||||||
<AuthLink variant="subtle" link="/sign-up/email-password">
|
<AuthLink variant="subtle" link="/sign-up/email-password">
|
||||||
Continue with email + password
|
Continue with email + password
|
||||||
@@ -33,13 +37,13 @@ const Index: React.FC = () => {
|
|||||||
export const SignUpPage: React.FC = () => {
|
export const SignUpPage: React.FC = () => {
|
||||||
return (
|
return (
|
||||||
<AuthLayout
|
<AuthLayout
|
||||||
title="Sign up"
|
title="Sign up to the application"
|
||||||
footer={
|
footer={
|
||||||
<Center>
|
<Center>
|
||||||
<Text>
|
<Text>
|
||||||
Already have an account?{' '}
|
Already have an account?{' '}
|
||||||
<Anchor component={Link} to="/sign-in">
|
<Anchor component={Link} to="/sign-in">
|
||||||
Log in
|
Sign in
|
||||||
</Anchor>
|
</Anchor>
|
||||||
</Text>
|
</Text>
|
||||||
</Center>
|
</Center>
|
||||||
@@ -49,6 +53,7 @@ export const SignUpPage: React.FC = () => {
|
|||||||
<Route path="/" element={<Index />} />
|
<Route path="/" element={<Index />} />
|
||||||
<Route path="/email-password" element={<EmailPassword />} />
|
<Route path="/email-password" element={<EmailPassword />} />
|
||||||
<Route path="/email-passwordless" element={<EmailPasswordless />} />
|
<Route path="/email-passwordless" element={<EmailPasswordless />} />
|
||||||
|
<Route path="/security-key" element={<SecurityKeySignUp />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</AuthLayout>
|
</AuthLayout>
|
||||||
)
|
)
|
||||||
|
|||||||
61
examples/react-apollo/src/sign-up/security-key.tsx
Normal file
61
examples/react-apollo/src/sign-up/security-key.tsx
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
import { FormEvent, useState } from 'react'
|
||||||
|
import { useNavigate } from 'react-router-dom'
|
||||||
|
|
||||||
|
import { Button, Modal, SimpleGrid, TextInput } from '@mantine/core'
|
||||||
|
import { showNotification } from '@mantine/notifications'
|
||||||
|
import { useSignUpEmailSecurityKeyEmail } from '@nhost/react'
|
||||||
|
|
||||||
|
export const SecurityKeySignUp: React.FC = () => {
|
||||||
|
const { signUpEmailSecurityKey } = useSignUpEmailSecurityKeyEmail()
|
||||||
|
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 signUpEmailSecurityKey(
|
||||||
|
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)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
A email has been sent to {email}. Please follow the link to verify your email address and to
|
||||||
|
complete your 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 up with a security key
|
||||||
|
</Button>
|
||||||
|
</form>
|
||||||
|
</SimpleGrid>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -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.0
|
||||||
storage:
|
storage:
|
||||||
image: nhost/hasura-storage:0.2.4
|
image: nhost/hasura-storage:0.2.4
|
||||||
auth:
|
auth:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Docker image versions used in the cloud
|
# Docker image versions used in the cloud
|
||||||
hasura: v2.10.1
|
hasura: v2.10.1
|
||||||
auth: 0.11.0
|
auth: 0.13.0
|
||||||
storage: 0.2.4
|
storage: 0.2.4
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
# @nhost/apollo
|
# @nhost/apollo
|
||||||
|
|
||||||
|
## 0.5.30
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [739a3c45]
|
||||||
|
- @nhost/nhost-js@1.5.0
|
||||||
|
|
||||||
## 0.5.29
|
## 0.5.29
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/apollo",
|
"name": "@nhost/apollo",
|
||||||
"version": "0.5.29",
|
"version": "0.5.30",
|
||||||
"description": "Nhost Apollo Client library",
|
"description": "Nhost Apollo Client library",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @nhost/core
|
# @nhost/core
|
||||||
|
|
||||||
|
## 0.8.0
|
||||||
|
|
||||||
|
### Minor Changes
|
||||||
|
|
||||||
|
- 8e4d790b: Sign up with an email and a security key.
|
||||||
|
|
||||||
## 0.7.7
|
## 0.7.7
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/core",
|
"name": "@nhost/core",
|
||||||
"version": "0.7.7",
|
"version": "0.8.0",
|
||||||
"description": "Nhost core client library",
|
"description": "Nhost core client library",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
import type { NhostSession, PasswordlessOptions, SignUpOptions } from '../types'
|
import type {
|
||||||
|
NhostSession,
|
||||||
|
PasswordlessOptions,
|
||||||
|
SignUpOptions,
|
||||||
|
SignUpSecurityKeyOptions
|
||||||
|
} from '../types'
|
||||||
|
|
||||||
export type AuthEvents =
|
export type AuthEvents =
|
||||||
| { type: 'SESSION_UPDATE'; data: { session: NhostSession } }
|
| { type: 'SESSION_UPDATE'; data: { session: NhostSession } }
|
||||||
@@ -18,6 +23,7 @@ export type AuthEvents =
|
|||||||
}
|
}
|
||||||
| { type: 'PASSWORDLESS_SMS_OTP'; phoneNumber?: string; otp?: string }
|
| { type: 'PASSWORDLESS_SMS_OTP'; phoneNumber?: string; otp?: string }
|
||||||
| { type: 'SIGNUP_EMAIL_PASSWORD'; email?: string; password?: string; options?: SignUpOptions }
|
| { type: 'SIGNUP_EMAIL_PASSWORD'; email?: string; password?: string; options?: SignUpOptions }
|
||||||
|
| { type: 'SIGNUP_SECURITY_KEY'; email?: string; options?: SignUpSecurityKeyOptions }
|
||||||
| { type: 'SIGNOUT'; all?: boolean }
|
| { type: 'SIGNOUT'; all?: boolean }
|
||||||
| { type: 'SIGNIN_MFA_TOTP'; ticket?: string; otp?: string }
|
| { type: 'SIGNIN_MFA_TOTP'; ticket?: string; otp?: string }
|
||||||
| { type: 'SIGNED_IN' }
|
| { type: 'SIGNED_IN' }
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import type { AxiosRequestConfig } from 'axios'
|
import type { AxiosRequestConfig } from 'axios'
|
||||||
import { assign, createMachine, send } from 'xstate'
|
import { assign, createMachine, send } from 'xstate'
|
||||||
|
|
||||||
import { startAuthentication } from '@simplewebauthn/browser'
|
import { startAuthentication, startRegistration } from '@simplewebauthn/browser'
|
||||||
import type {
|
import type {
|
||||||
AuthenticationCredentialJSON,
|
AuthenticationCredentialJSON,
|
||||||
PublicKeyCredentialRequestOptionsJSON
|
PublicKeyCredentialCreationOptionsJSON,
|
||||||
|
PublicKeyCredentialRequestOptionsJSON,
|
||||||
|
RegistrationCredentialJSON
|
||||||
} from '@simplewebauthn/typescript-types'
|
} from '@simplewebauthn/typescript-types'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -72,6 +74,7 @@ type AuthServices = {
|
|||||||
refreshToken: { data: NhostSessionResponse }
|
refreshToken: { data: NhostSessionResponse }
|
||||||
signout: { data: SignOutResponse }
|
signout: { data: SignOutResponse }
|
||||||
signUpEmailPassword: { data: SignUpResponse }
|
signUpEmailPassword: { data: SignUpResponse }
|
||||||
|
signUpSecurityKey: { data: SignUpResponse }
|
||||||
importRefreshToken: { data: NhostSessionResponse }
|
importRefreshToken: { data: NhostSessionResponse }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,6 +374,7 @@ export const createAuthMachine = ({
|
|||||||
incomplete: {
|
incomplete: {
|
||||||
on: {
|
on: {
|
||||||
SIGNUP_EMAIL_PASSWORD: 'emailPassword',
|
SIGNUP_EMAIL_PASSWORD: 'emailPassword',
|
||||||
|
SIGNUP_SECURITY_KEY: 'securityKey',
|
||||||
PASSWORDLESS_EMAIL: 'passwordlessEmail',
|
PASSWORDLESS_EMAIL: 'passwordlessEmail',
|
||||||
PASSWORDLESS_SMS: 'passwordlessSms',
|
PASSWORDLESS_SMS: 'passwordlessSms',
|
||||||
PASSWORDLESS_SMS_OTP: 'passwordlessSmsOtp'
|
PASSWORDLESS_SMS_OTP: 'passwordlessSmsOtp'
|
||||||
@@ -411,6 +415,34 @@ export const createAuthMachine = ({
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
securityKey: {
|
||||||
|
entry: ['resetErrors'],
|
||||||
|
invoke: {
|
||||||
|
src: 'signUpSecurityKey',
|
||||||
|
id: 'signUpSecurityKey',
|
||||||
|
onDone: [
|
||||||
|
{
|
||||||
|
cond: 'hasSession',
|
||||||
|
actions: ['saveSession', 'reportTokenChanged'],
|
||||||
|
target: '#nhost.authentication.signedIn'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
actions: 'clearContext',
|
||||||
|
target: ['#nhost.authentication.signedOut', 'incomplete.needsEmailVerification']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
onError: [
|
||||||
|
{
|
||||||
|
cond: 'unverified',
|
||||||
|
target: 'incomplete.needsEmailVerification'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
actions: 'saveRegistrationError',
|
||||||
|
target: 'incomplete.failed'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
passwordlessEmail: {
|
passwordlessEmail: {
|
||||||
entry: ['resetErrors'],
|
entry: ['resetErrors'],
|
||||||
invoke: {
|
invoke: {
|
||||||
@@ -772,7 +804,36 @@ export const createAuthMachine = ({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
signUpSecurityKey: async (_, { email, options }) => {
|
||||||
|
if (!isValidEmail(email)) {
|
||||||
|
return Promise.reject<SignUpResponse>({ error: INVALID_EMAIL_ERROR })
|
||||||
|
}
|
||||||
|
// TODO anonymous users
|
||||||
|
const nickname = options?.nickname
|
||||||
|
/*
|
||||||
|
* The `/signup/webauthn` endpoint accepts any option from SignUpOptions,
|
||||||
|
* We therefore remove the nickname from the options object before sending it to the server,
|
||||||
|
* as options if of type `SignUpSecurityKeyOptions`, which extends `SignUpOptions` with the optional `nickname` property.
|
||||||
|
*/
|
||||||
|
if (nickname) delete options.nickname
|
||||||
|
const webAuthnOptions = await postRequest<PublicKeyCredentialCreationOptionsJSON>(
|
||||||
|
'/signup/webauthn',
|
||||||
|
{ email, options }
|
||||||
|
)
|
||||||
|
let credential: RegistrationCredentialJSON
|
||||||
|
try {
|
||||||
|
credential = await startRegistration(webAuthnOptions)
|
||||||
|
} catch (e) {
|
||||||
|
throw new CodifiedError(e as Error)
|
||||||
|
}
|
||||||
|
return postRequest<SignUpResponse>('/signup/webauthn/verify', {
|
||||||
|
credential,
|
||||||
|
options: {
|
||||||
|
redirectTo: options?.redirectTo,
|
||||||
|
nickname
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
importRefreshToken: async () => {
|
importRefreshToken: async () => {
|
||||||
let error: ValidationErrorPayload | null = null
|
let error: ValidationErrorPayload | null = null
|
||||||
if (autoSignIn) {
|
if (autoSignIn) {
|
||||||
|
|||||||
@@ -2,110 +2,10 @@
|
|||||||
|
|
||||||
export interface Typegen0 {
|
export interface Typegen0 {
|
||||||
'@@xstate/typegen': true
|
'@@xstate/typegen': true
|
||||||
eventsCausingActions: {
|
|
||||||
saveSession:
|
|
||||||
| 'SESSION_UPDATE'
|
|
||||||
| 'done.invoke.importRefreshToken'
|
|
||||||
| 'done.invoke.authenticateUserWithPassword'
|
|
||||||
| 'done.invoke.authenticateAnonymously'
|
|
||||||
| 'done.invoke.signInMfaTotp'
|
|
||||||
| 'done.invoke.authenticateUserWithSecurityKey'
|
|
||||||
| 'done.invoke.refreshToken'
|
|
||||||
| 'done.invoke.authenticateWithToken'
|
|
||||||
| 'done.invoke.signUpEmailPassword'
|
|
||||||
| 'done.invoke.passwordlessSmsOtp'
|
|
||||||
resetTimer: 'SESSION_UPDATE' | 'done.invoke.refreshToken' | ''
|
|
||||||
reportTokenChanged:
|
|
||||||
| 'SESSION_UPDATE'
|
|
||||||
| 'done.invoke.importRefreshToken'
|
|
||||||
| 'done.invoke.authenticateUserWithPassword'
|
|
||||||
| 'done.invoke.authenticateAnonymously'
|
|
||||||
| 'done.invoke.signInMfaTotp'
|
|
||||||
| 'done.invoke.authenticateUserWithSecurityKey'
|
|
||||||
| 'done.invoke.refreshToken'
|
|
||||||
| 'done.invoke.authenticateWithToken'
|
|
||||||
| 'done.invoke.signUpEmailPassword'
|
|
||||||
| 'done.invoke.passwordlessSmsOtp'
|
|
||||||
saveAuthenticationError:
|
|
||||||
| 'error.platform.importRefreshToken'
|
|
||||||
| 'error.platform.signingOut'
|
|
||||||
| 'error.platform.authenticateUserWithPassword'
|
|
||||||
| 'error.platform.authenticateAnonymously'
|
|
||||||
| 'error.platform.signInMfaTotp'
|
|
||||||
| 'error.platform.authenticateUserWithSecurityKey'
|
|
||||||
| 'error.platform.authenticateWithToken'
|
|
||||||
saveMfaTicket: 'done.invoke.authenticateUserWithPassword'
|
|
||||||
saveRefreshAttempt: 'error.platform.refreshToken'
|
|
||||||
clearContext:
|
|
||||||
| 'done.invoke.signUpEmailPassword'
|
|
||||||
| 'done.invoke.passwordlessEmail'
|
|
||||||
| 'done.invoke.passwordlessSms'
|
|
||||||
saveRegistrationError:
|
|
||||||
| 'error.platform.signUpEmailPassword'
|
|
||||||
| 'error.platform.passwordlessEmail'
|
|
||||||
| 'error.platform.passwordlessSms'
|
|
||||||
| 'error.platform.passwordlessSmsOtp'
|
|
||||||
resetErrors:
|
|
||||||
| 'SESSION_UPDATE'
|
|
||||||
| 'done.invoke.importRefreshToken'
|
|
||||||
| ''
|
|
||||||
| 'done.invoke.authenticateUserWithPassword'
|
|
||||||
| 'done.invoke.authenticateAnonymously'
|
|
||||||
| 'done.invoke.signInMfaTotp'
|
|
||||||
| 'done.invoke.authenticateUserWithSecurityKey'
|
|
||||||
| 'done.invoke.authenticateWithToken'
|
|
||||||
| 'done.invoke.signUpEmailPassword'
|
|
||||||
| 'done.invoke.passwordlessSmsOtp'
|
|
||||||
| 'SIGNUP_EMAIL_PASSWORD'
|
|
||||||
| 'PASSWORDLESS_EMAIL'
|
|
||||||
| 'PASSWORDLESS_SMS'
|
|
||||||
| 'PASSWORDLESS_SMS_OTP'
|
|
||||||
reportSignedOut:
|
|
||||||
| 'error.platform.importRefreshToken'
|
|
||||||
| 'error.platform.authenticateUserWithPassword'
|
|
||||||
| 'error.platform.authenticateUserWithSecurityKey'
|
|
||||||
| 'done.invoke.signUpEmailPassword'
|
|
||||||
| 'done.invoke.passwordlessEmail'
|
|
||||||
| 'done.invoke.passwordlessSms'
|
|
||||||
destroyRefreshToken: 'xstate.init'
|
|
||||||
clearContextExceptRefreshToken: 'SIGNOUT'
|
|
||||||
reportSignedIn:
|
|
||||||
| 'SESSION_UPDATE'
|
|
||||||
| 'done.invoke.importRefreshToken'
|
|
||||||
| ''
|
|
||||||
| 'done.invoke.authenticateUserWithPassword'
|
|
||||||
| 'done.invoke.authenticateAnonymously'
|
|
||||||
| 'done.invoke.signInMfaTotp'
|
|
||||||
| 'done.invoke.authenticateUserWithSecurityKey'
|
|
||||||
| 'done.invoke.authenticateWithToken'
|
|
||||||
| 'done.invoke.signUpEmailPassword'
|
|
||||||
| 'done.invoke.passwordlessSmsOtp'
|
|
||||||
cleanUrl:
|
|
||||||
| 'SESSION_UPDATE'
|
|
||||||
| 'done.invoke.importRefreshToken'
|
|
||||||
| ''
|
|
||||||
| 'done.invoke.authenticateUserWithPassword'
|
|
||||||
| 'done.invoke.authenticateAnonymously'
|
|
||||||
| 'done.invoke.signInMfaTotp'
|
|
||||||
| 'done.invoke.authenticateUserWithSecurityKey'
|
|
||||||
| 'done.invoke.authenticateWithToken'
|
|
||||||
| 'done.invoke.signUpEmailPassword'
|
|
||||||
| 'done.invoke.passwordlessSmsOtp'
|
|
||||||
broadcastToken:
|
|
||||||
| 'SESSION_UPDATE'
|
|
||||||
| 'done.invoke.importRefreshToken'
|
|
||||||
| ''
|
|
||||||
| 'done.invoke.authenticateUserWithPassword'
|
|
||||||
| 'done.invoke.authenticateAnonymously'
|
|
||||||
| 'done.invoke.signInMfaTotp'
|
|
||||||
| 'done.invoke.authenticateUserWithSecurityKey'
|
|
||||||
| 'done.invoke.authenticateWithToken'
|
|
||||||
| 'done.invoke.signUpEmailPassword'
|
|
||||||
| 'done.invoke.passwordlessSmsOtp'
|
|
||||||
}
|
|
||||||
internalEvents: {
|
internalEvents: {
|
||||||
'done.invoke.importRefreshToken': {
|
'': { type: '' }
|
||||||
type: 'done.invoke.importRefreshToken'
|
'done.invoke.authenticateAnonymously': {
|
||||||
|
type: 'done.invoke.authenticateAnonymously'
|
||||||
data: unknown
|
data: unknown
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
||||||
}
|
}
|
||||||
@@ -114,65 +14,21 @@ export interface Typegen0 {
|
|||||||
data: unknown
|
data: unknown
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
||||||
}
|
}
|
||||||
'done.invoke.authenticateAnonymously': {
|
|
||||||
type: 'done.invoke.authenticateAnonymously'
|
|
||||||
data: unknown
|
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
|
||||||
}
|
|
||||||
'done.invoke.signInMfaTotp': {
|
|
||||||
type: 'done.invoke.signInMfaTotp'
|
|
||||||
data: unknown
|
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
|
||||||
}
|
|
||||||
'done.invoke.authenticateUserWithSecurityKey': {
|
'done.invoke.authenticateUserWithSecurityKey': {
|
||||||
type: 'done.invoke.authenticateUserWithSecurityKey'
|
type: 'done.invoke.authenticateUserWithSecurityKey'
|
||||||
data: unknown
|
data: unknown
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
||||||
}
|
}
|
||||||
'done.invoke.refreshToken': {
|
|
||||||
type: 'done.invoke.refreshToken'
|
|
||||||
data: unknown
|
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
|
||||||
}
|
|
||||||
'done.invoke.authenticateWithToken': {
|
'done.invoke.authenticateWithToken': {
|
||||||
type: 'done.invoke.authenticateWithToken'
|
type: 'done.invoke.authenticateWithToken'
|
||||||
data: unknown
|
data: unknown
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
||||||
}
|
}
|
||||||
'done.invoke.signUpEmailPassword': {
|
'done.invoke.importRefreshToken': {
|
||||||
type: 'done.invoke.signUpEmailPassword'
|
type: 'done.invoke.importRefreshToken'
|
||||||
data: unknown
|
data: unknown
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
||||||
}
|
}
|
||||||
'done.invoke.passwordlessSmsOtp': {
|
|
||||||
type: 'done.invoke.passwordlessSmsOtp'
|
|
||||||
data: unknown
|
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
|
||||||
}
|
|
||||||
'': { type: '' }
|
|
||||||
'error.platform.importRefreshToken': {
|
|
||||||
type: 'error.platform.importRefreshToken'
|
|
||||||
data: unknown
|
|
||||||
}
|
|
||||||
'error.platform.signingOut': { type: 'error.platform.signingOut'; data: unknown }
|
|
||||||
'error.platform.authenticateUserWithPassword': {
|
|
||||||
type: 'error.platform.authenticateUserWithPassword'
|
|
||||||
data: unknown
|
|
||||||
}
|
|
||||||
'error.platform.authenticateAnonymously': {
|
|
||||||
type: 'error.platform.authenticateAnonymously'
|
|
||||||
data: unknown
|
|
||||||
}
|
|
||||||
'error.platform.signInMfaTotp': { type: 'error.platform.signInMfaTotp'; data: unknown }
|
|
||||||
'error.platform.authenticateUserWithSecurityKey': {
|
|
||||||
type: 'error.platform.authenticateUserWithSecurityKey'
|
|
||||||
data: unknown
|
|
||||||
}
|
|
||||||
'error.platform.authenticateWithToken': {
|
|
||||||
type: 'error.platform.authenticateWithToken'
|
|
||||||
data: unknown
|
|
||||||
}
|
|
||||||
'error.platform.refreshToken': { type: 'error.platform.refreshToken'; data: unknown }
|
|
||||||
'done.invoke.passwordlessEmail': {
|
'done.invoke.passwordlessEmail': {
|
||||||
type: 'done.invoke.passwordlessEmail'
|
type: 'done.invoke.passwordlessEmail'
|
||||||
data: unknown
|
data: unknown
|
||||||
@@ -183,8 +39,54 @@ export interface Typegen0 {
|
|||||||
data: unknown
|
data: unknown
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
||||||
}
|
}
|
||||||
'error.platform.signUpEmailPassword': {
|
'done.invoke.passwordlessSmsOtp': {
|
||||||
type: 'error.platform.signUpEmailPassword'
|
type: 'done.invoke.passwordlessSmsOtp'
|
||||||
|
data: unknown
|
||||||
|
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
||||||
|
}
|
||||||
|
'done.invoke.refreshToken': {
|
||||||
|
type: 'done.invoke.refreshToken'
|
||||||
|
data: unknown
|
||||||
|
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
||||||
|
}
|
||||||
|
'done.invoke.signInMfaTotp': {
|
||||||
|
type: 'done.invoke.signInMfaTotp'
|
||||||
|
data: unknown
|
||||||
|
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
||||||
|
}
|
||||||
|
'done.invoke.signUpEmailPassword': {
|
||||||
|
type: 'done.invoke.signUpEmailPassword'
|
||||||
|
data: unknown
|
||||||
|
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
||||||
|
}
|
||||||
|
'done.invoke.signUpSecurityKey': {
|
||||||
|
type: 'done.invoke.signUpSecurityKey'
|
||||||
|
data: unknown
|
||||||
|
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
||||||
|
}
|
||||||
|
'done.invoke.signingOut': {
|
||||||
|
type: 'done.invoke.signingOut'
|
||||||
|
data: unknown
|
||||||
|
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
||||||
|
}
|
||||||
|
'error.platform.authenticateAnonymously': {
|
||||||
|
type: 'error.platform.authenticateAnonymously'
|
||||||
|
data: unknown
|
||||||
|
}
|
||||||
|
'error.platform.authenticateUserWithPassword': {
|
||||||
|
type: 'error.platform.authenticateUserWithPassword'
|
||||||
|
data: unknown
|
||||||
|
}
|
||||||
|
'error.platform.authenticateUserWithSecurityKey': {
|
||||||
|
type: 'error.platform.authenticateUserWithSecurityKey'
|
||||||
|
data: unknown
|
||||||
|
}
|
||||||
|
'error.platform.authenticateWithToken': {
|
||||||
|
type: 'error.platform.authenticateWithToken'
|
||||||
|
data: unknown
|
||||||
|
}
|
||||||
|
'error.platform.importRefreshToken': {
|
||||||
|
type: 'error.platform.importRefreshToken'
|
||||||
data: unknown
|
data: unknown
|
||||||
}
|
}
|
||||||
'error.platform.passwordlessEmail': { type: 'error.platform.passwordlessEmail'; data: unknown }
|
'error.platform.passwordlessEmail': { type: 'error.platform.passwordlessEmail'; data: unknown }
|
||||||
@@ -193,28 +95,33 @@ export interface Typegen0 {
|
|||||||
type: 'error.platform.passwordlessSmsOtp'
|
type: 'error.platform.passwordlessSmsOtp'
|
||||||
data: unknown
|
data: unknown
|
||||||
}
|
}
|
||||||
|
'error.platform.refreshToken': { type: 'error.platform.refreshToken'; data: unknown }
|
||||||
|
'error.platform.signInMfaTotp': { type: 'error.platform.signInMfaTotp'; data: unknown }
|
||||||
|
'error.platform.signUpEmailPassword': {
|
||||||
|
type: 'error.platform.signUpEmailPassword'
|
||||||
|
data: unknown
|
||||||
|
}
|
||||||
|
'error.platform.signUpSecurityKey': { type: 'error.platform.signUpSecurityKey'; data: unknown }
|
||||||
|
'error.platform.signingOut': { type: 'error.platform.signingOut'; data: unknown }
|
||||||
'xstate.after(1000)#nhost.authentication.signedIn.refreshTimer.running.pending': {
|
'xstate.after(1000)#nhost.authentication.signedIn.refreshTimer.running.pending': {
|
||||||
type: 'xstate.after(1000)#nhost.authentication.signedIn.refreshTimer.running.pending'
|
type: 'xstate.after(1000)#nhost.authentication.signedIn.refreshTimer.running.pending'
|
||||||
}
|
}
|
||||||
'xstate.init': { type: 'xstate.init' }
|
'xstate.init': { type: 'xstate.init' }
|
||||||
'done.invoke.signingOut': {
|
'xstate.stop': { type: 'xstate.stop' }
|
||||||
type: 'done.invoke.signingOut'
|
|
||||||
data: unknown
|
|
||||||
__tip: 'See the XState TS docs to learn how to strongly type this.'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
invokeSrcNameMap: {
|
invokeSrcNameMap: {
|
||||||
importRefreshToken: 'done.invoke.importRefreshToken'
|
importRefreshToken: 'done.invoke.importRefreshToken'
|
||||||
signout: 'done.invoke.signingOut'
|
|
||||||
signInPassword: 'done.invoke.authenticateUserWithPassword'
|
|
||||||
signInAnonymous: 'done.invoke.authenticateAnonymously'
|
|
||||||
signInMfaTotp: 'done.invoke.signInMfaTotp'
|
|
||||||
signInSecurityKeyEmail: 'done.invoke.authenticateUserWithSecurityKey'
|
|
||||||
refreshToken: 'done.invoke.refreshToken' | 'done.invoke.authenticateWithToken'
|
|
||||||
signUpEmailPassword: 'done.invoke.signUpEmailPassword'
|
|
||||||
passwordlessEmail: 'done.invoke.passwordlessEmail'
|
passwordlessEmail: 'done.invoke.passwordlessEmail'
|
||||||
passwordlessSms: 'done.invoke.passwordlessSms'
|
passwordlessSms: 'done.invoke.passwordlessSms'
|
||||||
passwordlessSmsOtp: 'done.invoke.passwordlessSmsOtp'
|
passwordlessSmsOtp: 'done.invoke.passwordlessSmsOtp'
|
||||||
|
refreshToken: 'done.invoke.refreshToken' | 'done.invoke.authenticateWithToken'
|
||||||
|
signInAnonymous: 'done.invoke.authenticateAnonymously'
|
||||||
|
signInMfaTotp: 'done.invoke.signInMfaTotp'
|
||||||
|
signInPassword: 'done.invoke.authenticateUserWithPassword'
|
||||||
|
signInSecurityKeyEmail: 'done.invoke.authenticateUserWithSecurityKey'
|
||||||
|
signUpEmailPassword: 'done.invoke.signUpEmailPassword'
|
||||||
|
signUpSecurityKey: 'done.invoke.signUpSecurityKey'
|
||||||
|
signout: 'done.invoke.signingOut'
|
||||||
}
|
}
|
||||||
missingImplementations: {
|
missingImplementations: {
|
||||||
actions: never
|
actions: never
|
||||||
@@ -222,92 +129,238 @@ export interface Typegen0 {
|
|||||||
guards: never
|
guards: never
|
||||||
delays: never
|
delays: never
|
||||||
}
|
}
|
||||||
|
eventsCausingActions: {
|
||||||
|
broadcastToken:
|
||||||
|
| ''
|
||||||
|
| 'SESSION_UPDATE'
|
||||||
|
| 'done.invoke.authenticateAnonymously'
|
||||||
|
| 'done.invoke.authenticateUserWithPassword'
|
||||||
|
| 'done.invoke.authenticateUserWithSecurityKey'
|
||||||
|
| 'done.invoke.authenticateWithToken'
|
||||||
|
| 'done.invoke.importRefreshToken'
|
||||||
|
| 'done.invoke.passwordlessSmsOtp'
|
||||||
|
| 'done.invoke.signInMfaTotp'
|
||||||
|
| 'done.invoke.signUpEmailPassword'
|
||||||
|
| 'done.invoke.signUpSecurityKey'
|
||||||
|
cleanUrl:
|
||||||
|
| ''
|
||||||
|
| 'SESSION_UPDATE'
|
||||||
|
| 'done.invoke.authenticateAnonymously'
|
||||||
|
| 'done.invoke.authenticateUserWithPassword'
|
||||||
|
| 'done.invoke.authenticateUserWithSecurityKey'
|
||||||
|
| 'done.invoke.authenticateWithToken'
|
||||||
|
| 'done.invoke.importRefreshToken'
|
||||||
|
| 'done.invoke.passwordlessSmsOtp'
|
||||||
|
| 'done.invoke.signInMfaTotp'
|
||||||
|
| 'done.invoke.signUpEmailPassword'
|
||||||
|
| 'done.invoke.signUpSecurityKey'
|
||||||
|
clearContext:
|
||||||
|
| 'done.invoke.passwordlessEmail'
|
||||||
|
| 'done.invoke.passwordlessSms'
|
||||||
|
| 'done.invoke.signUpEmailPassword'
|
||||||
|
| 'done.invoke.signUpSecurityKey'
|
||||||
|
clearContextExceptRefreshToken: 'SIGNOUT'
|
||||||
|
destroyRefreshToken:
|
||||||
|
| 'SESSION_UPDATE'
|
||||||
|
| 'SIGNIN_ANONYMOUS'
|
||||||
|
| 'SIGNIN_MFA_TOTP'
|
||||||
|
| 'SIGNIN_PASSWORD'
|
||||||
|
| 'SIGNIN_SECURITY_KEY_EMAIL'
|
||||||
|
| 'done.invoke.signingOut'
|
||||||
|
| 'error.platform.signingOut'
|
||||||
|
| 'xstate.stop'
|
||||||
|
reportSignedIn:
|
||||||
|
| ''
|
||||||
|
| 'SESSION_UPDATE'
|
||||||
|
| 'done.invoke.authenticateAnonymously'
|
||||||
|
| 'done.invoke.authenticateUserWithPassword'
|
||||||
|
| 'done.invoke.authenticateUserWithSecurityKey'
|
||||||
|
| 'done.invoke.authenticateWithToken'
|
||||||
|
| 'done.invoke.importRefreshToken'
|
||||||
|
| 'done.invoke.passwordlessSmsOtp'
|
||||||
|
| 'done.invoke.signInMfaTotp'
|
||||||
|
| 'done.invoke.signUpEmailPassword'
|
||||||
|
| 'done.invoke.signUpSecurityKey'
|
||||||
|
reportSignedOut:
|
||||||
|
| 'SIGNOUT'
|
||||||
|
| 'done.invoke.authenticateUserWithPassword'
|
||||||
|
| 'done.invoke.passwordlessEmail'
|
||||||
|
| 'done.invoke.passwordlessSms'
|
||||||
|
| 'done.invoke.signUpEmailPassword'
|
||||||
|
| 'done.invoke.signUpSecurityKey'
|
||||||
|
| 'error.platform.authenticateAnonymously'
|
||||||
|
| 'error.platform.authenticateUserWithPassword'
|
||||||
|
| 'error.platform.authenticateUserWithSecurityKey'
|
||||||
|
| 'error.platform.authenticateWithToken'
|
||||||
|
| 'error.platform.importRefreshToken'
|
||||||
|
| 'error.platform.signInMfaTotp'
|
||||||
|
reportTokenChanged:
|
||||||
|
| 'SESSION_UPDATE'
|
||||||
|
| 'SIGNIN_ANONYMOUS'
|
||||||
|
| 'SIGNIN_MFA_TOTP'
|
||||||
|
| 'SIGNIN_PASSWORD'
|
||||||
|
| 'SIGNIN_SECURITY_KEY_EMAIL'
|
||||||
|
| 'done.invoke.authenticateAnonymously'
|
||||||
|
| 'done.invoke.authenticateUserWithPassword'
|
||||||
|
| 'done.invoke.authenticateUserWithSecurityKey'
|
||||||
|
| 'done.invoke.authenticateWithToken'
|
||||||
|
| 'done.invoke.importRefreshToken'
|
||||||
|
| 'done.invoke.passwordlessSmsOtp'
|
||||||
|
| 'done.invoke.refreshToken'
|
||||||
|
| 'done.invoke.signInMfaTotp'
|
||||||
|
| 'done.invoke.signUpEmailPassword'
|
||||||
|
| 'done.invoke.signUpSecurityKey'
|
||||||
|
| 'done.invoke.signingOut'
|
||||||
|
| 'error.platform.signingOut'
|
||||||
|
| 'xstate.stop'
|
||||||
|
resetErrors:
|
||||||
|
| ''
|
||||||
|
| 'PASSWORDLESS_EMAIL'
|
||||||
|
| 'PASSWORDLESS_SMS'
|
||||||
|
| 'PASSWORDLESS_SMS_OTP'
|
||||||
|
| 'SESSION_UPDATE'
|
||||||
|
| 'SIGNIN_ANONYMOUS'
|
||||||
|
| 'SIGNIN_MFA_TOTP'
|
||||||
|
| 'SIGNIN_PASSWORD'
|
||||||
|
| 'SIGNIN_SECURITY_KEY_EMAIL'
|
||||||
|
| 'SIGNUP_EMAIL_PASSWORD'
|
||||||
|
| 'SIGNUP_SECURITY_KEY'
|
||||||
|
| 'done.invoke.authenticateAnonymously'
|
||||||
|
| 'done.invoke.authenticateUserWithPassword'
|
||||||
|
| 'done.invoke.authenticateUserWithSecurityKey'
|
||||||
|
| 'done.invoke.authenticateWithToken'
|
||||||
|
| 'done.invoke.importRefreshToken'
|
||||||
|
| 'done.invoke.passwordlessEmail'
|
||||||
|
| 'done.invoke.passwordlessSms'
|
||||||
|
| 'done.invoke.passwordlessSmsOtp'
|
||||||
|
| 'done.invoke.signInMfaTotp'
|
||||||
|
| 'done.invoke.signUpEmailPassword'
|
||||||
|
| 'done.invoke.signUpSecurityKey'
|
||||||
|
| 'error.platform.authenticateWithToken'
|
||||||
|
| 'xstate.init'
|
||||||
|
resetTimer: '' | 'SESSION_UPDATE' | 'done.invoke.refreshToken'
|
||||||
|
saveAuthenticationError:
|
||||||
|
| 'error.platform.authenticateAnonymously'
|
||||||
|
| 'error.platform.authenticateUserWithPassword'
|
||||||
|
| 'error.platform.authenticateUserWithSecurityKey'
|
||||||
|
| 'error.platform.authenticateWithToken'
|
||||||
|
| 'error.platform.importRefreshToken'
|
||||||
|
| 'error.platform.signInMfaTotp'
|
||||||
|
| 'error.platform.signingOut'
|
||||||
|
saveMfaTicket: 'done.invoke.authenticateUserWithPassword'
|
||||||
|
saveRefreshAttempt: 'error.platform.refreshToken'
|
||||||
|
saveRegistrationError:
|
||||||
|
| 'error.platform.passwordlessEmail'
|
||||||
|
| 'error.platform.passwordlessSms'
|
||||||
|
| 'error.platform.passwordlessSmsOtp'
|
||||||
|
| 'error.platform.signUpEmailPassword'
|
||||||
|
| 'error.platform.signUpSecurityKey'
|
||||||
|
saveSession:
|
||||||
|
| 'SESSION_UPDATE'
|
||||||
|
| 'done.invoke.authenticateAnonymously'
|
||||||
|
| 'done.invoke.authenticateUserWithPassword'
|
||||||
|
| 'done.invoke.authenticateUserWithSecurityKey'
|
||||||
|
| 'done.invoke.authenticateWithToken'
|
||||||
|
| 'done.invoke.importRefreshToken'
|
||||||
|
| 'done.invoke.passwordlessSmsOtp'
|
||||||
|
| 'done.invoke.refreshToken'
|
||||||
|
| 'done.invoke.signInMfaTotp'
|
||||||
|
| 'done.invoke.signUpEmailPassword'
|
||||||
|
| 'done.invoke.signUpSecurityKey'
|
||||||
|
}
|
||||||
eventsCausingServices: {
|
eventsCausingServices: {
|
||||||
importRefreshToken: 'xstate.init'
|
importRefreshToken:
|
||||||
signInPassword: 'SIGNIN_PASSWORD'
|
| 'done.invoke.authenticateWithToken'
|
||||||
signInAnonymous: 'SIGNIN_ANONYMOUS'
|
| 'done.invoke.passwordlessEmail'
|
||||||
signInSecurityKeyEmail: 'SIGNIN_SECURITY_KEY_EMAIL'
|
| 'done.invoke.passwordlessSms'
|
||||||
signInMfaTotp: 'SIGNIN_MFA_TOTP'
|
| 'done.invoke.passwordlessSmsOtp'
|
||||||
signout: 'SIGNOUT'
|
| 'done.invoke.signUpEmailPassword'
|
||||||
refreshToken: '' | 'TRY_TOKEN'
|
| 'done.invoke.signUpSecurityKey'
|
||||||
signUpEmailPassword: 'SIGNUP_EMAIL_PASSWORD'
|
| 'error.platform.authenticateWithToken'
|
||||||
|
| 'xstate.init'
|
||||||
passwordlessEmail: 'PASSWORDLESS_EMAIL'
|
passwordlessEmail: 'PASSWORDLESS_EMAIL'
|
||||||
passwordlessSms: 'PASSWORDLESS_SMS'
|
passwordlessSms: 'PASSWORDLESS_SMS'
|
||||||
passwordlessSmsOtp: 'PASSWORDLESS_SMS_OTP'
|
passwordlessSmsOtp: 'PASSWORDLESS_SMS_OTP'
|
||||||
|
refreshToken: '' | 'TRY_TOKEN'
|
||||||
|
signInAnonymous: 'SIGNIN_ANONYMOUS'
|
||||||
|
signInMfaTotp: 'SIGNIN_MFA_TOTP'
|
||||||
|
signInPassword: 'SIGNIN_PASSWORD'
|
||||||
|
signInSecurityKeyEmail: 'SIGNIN_SECURITY_KEY_EMAIL'
|
||||||
|
signUpEmailPassword: 'SIGNUP_EMAIL_PASSWORD'
|
||||||
|
signUpSecurityKey: 'SIGNUP_SECURITY_KEY'
|
||||||
|
signout: 'SIGNOUT'
|
||||||
}
|
}
|
||||||
eventsCausingGuards: {
|
eventsCausingGuards: {
|
||||||
hasSession: 'SESSION_UPDATE' | 'done.invoke.signUpEmailPassword'
|
|
||||||
isSignedIn: '' | 'error.platform.authenticateWithToken'
|
|
||||||
hasMfaTicket: 'done.invoke.authenticateUserWithPassword'
|
hasMfaTicket: 'done.invoke.authenticateUserWithPassword'
|
||||||
|
hasRefreshToken: ''
|
||||||
|
hasSession:
|
||||||
|
| 'SESSION_UPDATE'
|
||||||
|
| 'done.invoke.signUpEmailPassword'
|
||||||
|
| 'done.invoke.signUpSecurityKey'
|
||||||
|
isAnonymous: 'SIGNED_IN'
|
||||||
|
isAutoRefreshDisabled: ''
|
||||||
|
isSignedIn: '' | 'error.platform.authenticateWithToken'
|
||||||
|
noToken: ''
|
||||||
|
refreshTimerShouldRefresh: ''
|
||||||
unverified:
|
unverified:
|
||||||
| 'error.platform.authenticateUserWithPassword'
|
| 'error.platform.authenticateUserWithPassword'
|
||||||
| 'error.platform.authenticateUserWithSecurityKey'
|
| 'error.platform.authenticateUserWithSecurityKey'
|
||||||
| 'error.platform.signUpEmailPassword'
|
| 'error.platform.signUpEmailPassword'
|
||||||
noToken: ''
|
| 'error.platform.signUpSecurityKey'
|
||||||
isAutoRefreshDisabled: ''
|
|
||||||
hasRefreshToken: ''
|
|
||||||
refreshTimerShouldRefresh: ''
|
|
||||||
isAnonymous: 'SIGNED_IN'
|
|
||||||
}
|
}
|
||||||
eventsCausingDelays: {}
|
eventsCausingDelays: {}
|
||||||
matchesStates:
|
matchesStates:
|
||||||
| 'authentication'
|
| 'authentication'
|
||||||
| 'authentication.starting'
|
|
||||||
| 'authentication.signedOut'
|
|
||||||
| 'authentication.signedOut.noErrors'
|
|
||||||
| 'authentication.signedOut.success'
|
|
||||||
| 'authentication.signedOut.needsSmsOtp'
|
|
||||||
| 'authentication.signedOut.needsMfa'
|
|
||||||
| 'authentication.signedOut.failed'
|
|
||||||
| 'authentication.signedOut.signingOut'
|
|
||||||
| 'authentication.authenticating'
|
| 'authentication.authenticating'
|
||||||
| 'authentication.authenticating.password'
|
|
||||||
| 'authentication.authenticating.anonymous'
|
| 'authentication.authenticating.anonymous'
|
||||||
| 'authentication.authenticating.mfa'
|
| 'authentication.authenticating.mfa'
|
||||||
| 'authentication.authenticating.mfa.totp'
|
| 'authentication.authenticating.mfa.totp'
|
||||||
|
| 'authentication.authenticating.password'
|
||||||
| 'authentication.authenticating.securityKeyEmail'
|
| 'authentication.authenticating.securityKeyEmail'
|
||||||
| 'authentication.signedIn'
|
| 'authentication.signedIn'
|
||||||
| 'authentication.signedIn.refreshTimer'
|
| 'authentication.signedIn.refreshTimer'
|
||||||
| 'authentication.signedIn.refreshTimer.disabled'
|
| 'authentication.signedIn.refreshTimer.disabled'
|
||||||
| 'authentication.signedIn.refreshTimer.stopped'
|
|
||||||
| 'authentication.signedIn.refreshTimer.idle'
|
| 'authentication.signedIn.refreshTimer.idle'
|
||||||
| 'authentication.signedIn.refreshTimer.running'
|
| 'authentication.signedIn.refreshTimer.running'
|
||||||
| 'authentication.signedIn.refreshTimer.running.pending'
|
| 'authentication.signedIn.refreshTimer.running.pending'
|
||||||
| 'authentication.signedIn.refreshTimer.running.refreshing'
|
| 'authentication.signedIn.refreshTimer.running.refreshing'
|
||||||
| 'token'
|
| 'authentication.signedIn.refreshTimer.stopped'
|
||||||
| 'token.idle'
|
| 'authentication.signedOut'
|
||||||
| 'token.idle.noErrors'
|
| 'authentication.signedOut.failed'
|
||||||
| 'token.idle.error'
|
| 'authentication.signedOut.needsMfa'
|
||||||
| 'token.running'
|
| 'authentication.signedOut.needsSmsOtp'
|
||||||
|
| 'authentication.signedOut.noErrors'
|
||||||
|
| 'authentication.signedOut.signingOut'
|
||||||
|
| 'authentication.signedOut.success'
|
||||||
|
| 'authentication.starting'
|
||||||
| 'registration'
|
| 'registration'
|
||||||
|
| 'registration.complete'
|
||||||
|
| 'registration.emailPassword'
|
||||||
| 'registration.incomplete'
|
| 'registration.incomplete'
|
||||||
| 'registration.incomplete.noErrors'
|
| 'registration.incomplete.failed'
|
||||||
| 'registration.incomplete.needsEmailVerification'
|
| 'registration.incomplete.needsEmailVerification'
|
||||||
| 'registration.incomplete.needsOtp'
|
| 'registration.incomplete.needsOtp'
|
||||||
| 'registration.incomplete.failed'
|
| 'registration.incomplete.noErrors'
|
||||||
| 'registration.emailPassword'
|
|
||||||
| 'registration.passwordlessEmail'
|
| 'registration.passwordlessEmail'
|
||||||
| 'registration.passwordlessSms'
|
| 'registration.passwordlessSms'
|
||||||
| 'registration.passwordlessSmsOtp'
|
| 'registration.passwordlessSmsOtp'
|
||||||
| 'registration.complete'
|
| 'registration.securityKey'
|
||||||
|
| 'token'
|
||||||
|
| 'token.idle'
|
||||||
|
| 'token.idle.error'
|
||||||
|
| 'token.idle.noErrors'
|
||||||
|
| 'token.running'
|
||||||
| {
|
| {
|
||||||
authentication?:
|
authentication?:
|
||||||
| 'starting'
|
|
||||||
| 'signedOut'
|
|
||||||
| 'authenticating'
|
| 'authenticating'
|
||||||
| 'signedIn'
|
| 'signedIn'
|
||||||
|
| 'signedOut'
|
||||||
|
| 'starting'
|
||||||
| {
|
| {
|
||||||
signedOut?:
|
|
||||||
| 'noErrors'
|
|
||||||
| 'success'
|
|
||||||
| 'needsSmsOtp'
|
|
||||||
| 'needsMfa'
|
|
||||||
| 'failed'
|
|
||||||
| 'signingOut'
|
|
||||||
authenticating?:
|
authenticating?:
|
||||||
| 'password'
|
|
||||||
| 'anonymous'
|
| 'anonymous'
|
||||||
| 'mfa'
|
| 'mfa'
|
||||||
|
| 'password'
|
||||||
| 'securityKeyEmail'
|
| 'securityKeyEmail'
|
||||||
| { mfa?: 'totp' }
|
| { mfa?: 'totp' }
|
||||||
signedIn?:
|
signedIn?:
|
||||||
@@ -315,21 +368,29 @@ export interface Typegen0 {
|
|||||||
| {
|
| {
|
||||||
refreshTimer?:
|
refreshTimer?:
|
||||||
| 'disabled'
|
| 'disabled'
|
||||||
| 'stopped'
|
|
||||||
| 'idle'
|
| 'idle'
|
||||||
| 'running'
|
| 'running'
|
||||||
|
| 'stopped'
|
||||||
| { running?: 'pending' | 'refreshing' }
|
| { running?: 'pending' | 'refreshing' }
|
||||||
}
|
}
|
||||||
|
signedOut?:
|
||||||
|
| 'failed'
|
||||||
|
| 'needsMfa'
|
||||||
|
| 'needsSmsOtp'
|
||||||
|
| 'noErrors'
|
||||||
|
| 'signingOut'
|
||||||
|
| 'success'
|
||||||
}
|
}
|
||||||
token?: 'idle' | 'running' | { idle?: 'noErrors' | 'error' }
|
|
||||||
registration?:
|
registration?:
|
||||||
| 'incomplete'
|
| 'complete'
|
||||||
| 'emailPassword'
|
| 'emailPassword'
|
||||||
|
| 'incomplete'
|
||||||
| 'passwordlessEmail'
|
| 'passwordlessEmail'
|
||||||
| 'passwordlessSms'
|
| 'passwordlessSms'
|
||||||
| 'passwordlessSmsOtp'
|
| 'passwordlessSmsOtp'
|
||||||
| 'complete'
|
| 'securityKey'
|
||||||
| { incomplete?: 'noErrors' | 'needsEmailVerification' | 'needsOtp' | 'failed' }
|
| { incomplete?: 'failed' | 'needsEmailVerification' | 'needsOtp' | 'noErrors' }
|
||||||
|
token?: 'idle' | 'running' | { idle?: 'error' | 'noErrors' }
|
||||||
}
|
}
|
||||||
tags: 'loading'
|
tags: 'loading'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,11 @@ export * from './sendVerificationEmail'
|
|||||||
export * from './signInAnonymous'
|
export * from './signInAnonymous'
|
||||||
export * from './signInEmailPassword'
|
export * from './signInEmailPassword'
|
||||||
export * from './signInEmailPasswordless'
|
export * from './signInEmailPasswordless'
|
||||||
|
export * from './signInEmailSecurityKey'
|
||||||
export * from './signInMfaTotp'
|
export * from './signInMfaTotp'
|
||||||
export * from './signInSecurityKeyEmail'
|
|
||||||
export * from './signInSmsPasswordless'
|
export * from './signInSmsPasswordless'
|
||||||
export * from './signInSmsPasswordlessOtp'
|
export * from './signInSmsPasswordlessOtp'
|
||||||
export * from './signOut'
|
export * from './signOut'
|
||||||
export * from './signUpEmailPassword'
|
export * from './signUpEmailPassword'
|
||||||
|
export * from './signUpEmailSecurityKey'
|
||||||
export * from './types'
|
export * from './types'
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export interface SignInSecurityKeyPasswordlessState
|
|||||||
extends SignInSecurityKeyPasswordlessHandlerResult,
|
extends SignInSecurityKeyPasswordlessHandlerResult,
|
||||||
ActionLoadingState {}
|
ActionLoadingState {}
|
||||||
|
|
||||||
export const signInSecurityKeyEmailPromise = (interpreter: AuthInterpreter, email: string) =>
|
export const signInEmailSecurityKeyPromise = (interpreter: AuthInterpreter, email: string) =>
|
||||||
new Promise<SignInSecurityKeyPasswordlessHandlerResult>((resolve) => {
|
new Promise<SignInSecurityKeyPasswordlessHandlerResult>((resolve) => {
|
||||||
const { changed, context } = interpreter.send({ type: 'SIGNIN_SECURITY_KEY_EMAIL', email })
|
const { changed, context } = interpreter.send({ type: 'SIGNIN_SECURITY_KEY_EMAIL', email })
|
||||||
if (!changed) {
|
if (!changed) {
|
||||||
73
packages/core/src/promises/signUpEmailSecurityKey.ts
Normal file
73
packages/core/src/promises/signUpEmailSecurityKey.ts
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
import { USER_ALREADY_SIGNED_IN } from '../errors'
|
||||||
|
import { AuthInterpreter, SignUpSecurityKeyOptions } from '../types'
|
||||||
|
|
||||||
|
import {
|
||||||
|
ActionLoadingState,
|
||||||
|
NeedsEmailVerificationState,
|
||||||
|
SessionActionHandlerResult
|
||||||
|
} from './types'
|
||||||
|
|
||||||
|
export interface SignUpSecurityKeyHandlerResult
|
||||||
|
extends SessionActionHandlerResult,
|
||||||
|
NeedsEmailVerificationState {}
|
||||||
|
|
||||||
|
export interface SignUpSecurityKeyState
|
||||||
|
extends SignUpSecurityKeyHandlerResult,
|
||||||
|
ActionLoadingState {}
|
||||||
|
|
||||||
|
export const signUpEmailSecurityKeyPromise = (
|
||||||
|
interpreter: AuthInterpreter,
|
||||||
|
email: string,
|
||||||
|
options?: SignUpSecurityKeyOptions
|
||||||
|
): Promise<SignUpSecurityKeyHandlerResult> =>
|
||||||
|
new Promise<SignUpSecurityKeyHandlerResult>((resolve) => {
|
||||||
|
const { changed, context } = interpreter.send('SIGNUP_SECURITY_KEY', {
|
||||||
|
email,
|
||||||
|
options
|
||||||
|
})
|
||||||
|
if (!changed) {
|
||||||
|
return resolve({
|
||||||
|
error: USER_ALREADY_SIGNED_IN,
|
||||||
|
accessToken: context.accessToken.value,
|
||||||
|
isError: true,
|
||||||
|
isSuccess: false,
|
||||||
|
needsEmailVerification: false,
|
||||||
|
user: context.user
|
||||||
|
})
|
||||||
|
}
|
||||||
|
interpreter.onTransition((state) => {
|
||||||
|
if (state.matches('registration.incomplete.failed')) {
|
||||||
|
resolve({
|
||||||
|
accessToken: null,
|
||||||
|
error: state.context.errors.registration || null,
|
||||||
|
isError: true,
|
||||||
|
isSuccess: false,
|
||||||
|
needsEmailVerification: false,
|
||||||
|
user: null
|
||||||
|
})
|
||||||
|
} else if (
|
||||||
|
state.matches({
|
||||||
|
authentication: { signedOut: 'noErrors' },
|
||||||
|
registration: { incomplete: 'needsEmailVerification' }
|
||||||
|
})
|
||||||
|
) {
|
||||||
|
resolve({
|
||||||
|
accessToken: null,
|
||||||
|
error: null,
|
||||||
|
isError: false,
|
||||||
|
isSuccess: false,
|
||||||
|
needsEmailVerification: true,
|
||||||
|
user: null
|
||||||
|
})
|
||||||
|
} else if (state.matches({ authentication: 'signedIn', registration: 'complete' })) {
|
||||||
|
resolve({
|
||||||
|
accessToken: state.context.accessToken.value,
|
||||||
|
error: null,
|
||||||
|
isError: false,
|
||||||
|
isSuccess: true,
|
||||||
|
needsEmailVerification: false,
|
||||||
|
user: state.context.user
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -80,6 +80,11 @@ export interface RedirectOption {
|
|||||||
|
|
||||||
export interface PasswordlessOptions extends RegistrationOptions, RedirectOption {}
|
export interface PasswordlessOptions extends RegistrationOptions, RedirectOption {}
|
||||||
export interface SignUpOptions extends RegistrationOptions, RedirectOption {}
|
export interface SignUpOptions extends RegistrationOptions, RedirectOption {}
|
||||||
|
export interface SignUpSecurityKeyOptions extends SignUpOptions {
|
||||||
|
/** Optional nickname for the security key */
|
||||||
|
nickname?: string
|
||||||
|
}
|
||||||
|
|
||||||
export interface ChangeEmailOptions extends RedirectOption {}
|
export interface ChangeEmailOptions extends RedirectOption {}
|
||||||
export interface ResetPasswordOptions extends RedirectOption {}
|
export interface ResetPasswordOptions extends RedirectOption {}
|
||||||
export interface SendVerificationEmailOptions extends RedirectOption {}
|
export interface SendVerificationEmailOptions extends RedirectOption {}
|
||||||
|
|||||||
@@ -10,5 +10,6 @@ export * from './resetPasswordHandlers'
|
|||||||
export * from './sendVerificationEmailHandlers'
|
export * from './sendVerificationEmailHandlers'
|
||||||
export * from './signOutHandlers'
|
export * from './signOutHandlers'
|
||||||
export * from './signUpHandlers'
|
export * from './signUpHandlers'
|
||||||
|
export * from './securityKeySignUpHandlers'
|
||||||
export * from './anonymousHandlers'
|
export * from './anonymousHandlers'
|
||||||
export * from './securityKeySignInHandlers'
|
export * from './securityKeySignInHandlers'
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user