Compare commits
12 Commits
@nhost/das
...
@nhost/rea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60b685ab02 | ||
|
|
2e65bc6dc0 | ||
|
|
14e6100722 | ||
|
|
479dba102e | ||
|
|
c9b84c7658 | ||
|
|
c78a765941 | ||
|
|
72899a600f | ||
|
|
fe6e8e2d15 | ||
|
|
737945bd0b | ||
|
|
8f77914eb3 | ||
|
|
839ca68f74 | ||
|
|
10b0f7490e |
@@ -15,6 +15,8 @@
|
||||
<a href="https://twitter.com/nhost">Twitter</a>
|
||||
<span> • </span>
|
||||
<a href="https://nhost.io/discord">Discord</a>
|
||||
<span> • </span>
|
||||
<a href="https://gurubase.io/g/nhost">Ask Nhost Guru (third party, unofficial)</a>
|
||||
<br />
|
||||
|
||||
<hr />
|
||||
@@ -148,4 +150,4 @@ Here are some ways of contributing to making Nhost better:
|
||||
<p align="center">
|
||||
<img width="720" src="https://contrib.rocks/image?repo=nhost/nhost" alt="A table of avatars from the project's contributors" />
|
||||
</p>
|
||||
</a>
|
||||
</a>
|
||||
17
changelog_summary.sh
Executable file
17
changelog_summary.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#/usr/bin/env bash
|
||||
PREV_MONTH=$(date -d "1 month ago" +%Y-%m)
|
||||
|
||||
echo "prev: $PREV_MONTH"
|
||||
|
||||
files=$(git log --since="$PREV_MONTH-01" --until="$PREV_MONTH-31" --name-only -- '**/CHANGELOG.md' | grep CHANGE | sort -u)
|
||||
|
||||
echo "files: $files"
|
||||
|
||||
echo "Below you can find the latest release for each individual package released during this month:"
|
||||
echo
|
||||
|
||||
for file in $files; do
|
||||
name=$(grep '^# ' $file | awk '{ print substr($0, 4) }')
|
||||
last_release=$(grep '^## ' $file | awk '{ print substr($0, 4) }' | head -n 1)
|
||||
echo "@$name: $last_release [CHANGELOG.md](https://github.com/nhost/nhost/blob/main/$file)"
|
||||
done
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/dashboard",
|
||||
"version": "2.7.0",
|
||||
"version": "2.7.2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
|
||||
@@ -3,10 +3,10 @@ import { Form } from '@/components/form/Form';
|
||||
import { Alert } from '@/components/ui/v2/Alert';
|
||||
import { Button } from '@/components/ui/v2/Button';
|
||||
import { Input } from '@/components/ui/v2/Input';
|
||||
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
|
||||
import { useRemoteApplicationGQLClient } from '@/hooks/useRemoteApplicationGQLClient';
|
||||
import { useRemoteApplicationGQLClient } from '@/features/orgs/hooks/useRemoteApplicationGQLClient';
|
||||
import { useProject } from '@/features/orgs/projects/hooks/useProject';
|
||||
import { execPromiseWithErrorToast } from '@/features/orgs/utils/execPromiseWithErrorToast';
|
||||
import type { DialogFormProps } from '@/types/common';
|
||||
import { execPromiseWithErrorToast } from '@/utils/execPromiseWithErrorToast';
|
||||
import type { RemoteAppGetUsersQuery } from '@/utils/__generated__/graphql';
|
||||
import {
|
||||
useGetSignInMethodsQuery,
|
||||
@@ -38,10 +38,10 @@ export default function EditUserPasswordForm({
|
||||
client: remoteProjectGQLClient,
|
||||
});
|
||||
const { closeDialog } = useDialog();
|
||||
const { currentProject } = useCurrentWorkspaceAndProject();
|
||||
const { project } = useProject();
|
||||
const { data } = useGetSignInMethodsQuery({
|
||||
variables: { appId: currentProject?.id },
|
||||
skip: !currentProject?.id,
|
||||
variables: { appId: project?.id },
|
||||
skip: !project?.id,
|
||||
});
|
||||
|
||||
const passwordMinLength =
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @nhost/docs
|
||||
|
||||
## 2.23.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 14e6100: feat: add documentation for sign-in with ID token
|
||||
|
||||
## 2.22.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 10b0f74: feat: add jwt docs + openapi improvements
|
||||
- fe6e8e2: feat: add signin with otp reference docs
|
||||
- 8f77914: fix: added pg_repack and an extension overview to database guide
|
||||
|
||||
## 2.21.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
315
docs/guides/auth/jwt.mdx
Normal file
315
docs/guides/auth/jwt.mdx
Normal file
@@ -0,0 +1,315 @@
|
||||
---
|
||||
title: JSON Web Tokens (JWTs)
|
||||
description: Configure JSON Web Tokens to your needs
|
||||
icon: key
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
JSON Web Tokens (JWT) are encoded strings designed to securely transmit information between parties in the form of a JSON object. Each JWT consists of three parts:
|
||||
|
||||
- header
|
||||
- payload
|
||||
- signature
|
||||
|
||||
JWTs are commonly used for authentication post-login. The server generates a token containing user claims (like identity and permissions) that subsequent requests can include to prove authorization.
|
||||
|
||||
Here's how JWTs typically work in an authentication flow:
|
||||
|
||||
1. User logs in with credentials (username/password)
|
||||
2. Server validates credentials and generates a signed JWT containing user information and permissions
|
||||
3. Server sends the JWT to the client, which stores it (usually in browser storage)
|
||||
4. For subsequent requests, the client includes the JWT in the Authorization header
|
||||
5. Server verifies the token's signature and grants access based on the encoded permissions
|
||||
|
||||
The main advantage is that the server doesn't need to store session information - all necessary data is contained within the token itself, making it ideal for stateless authentication.
|
||||
|
||||
<Info>For more information about JSON Web Tokens, visit [jwt.io](https://jwt.io).</Info>
|
||||
|
||||
## JWT Configuration
|
||||
|
||||
You can configure your project to use three different kinds of JWTs:
|
||||
|
||||
- JWTs signed with symmetric keys
|
||||
- JWTs signed with asymmetric keys
|
||||
- JWTs signed externally via a third-party service
|
||||
|
||||
<Note>
|
||||
Currently we default to using symmetric keys for signing JWTs. However, we plan to change this to use asymmetric keys in the near future.
|
||||
</Note>
|
||||
|
||||
### Symmetric Keys
|
||||
|
||||
With symmetric keys, your project uses a single key for both signing and verifying JWTs. This key is stored in the project's configuration and is responsible for signing JWTs. When a client sends a JWT to the server, the server uses the same key to verify the JWT’s signature. If you need to verify JWTs in a different service, the same key can be used for verification. Since the same key is used for both signing and verification, it is crucial to keep it secret, as sharing it with others can compromise the security of your JWTs.
|
||||
|
||||
|
||||
Below you can see an example of a symmetric key configuration:
|
||||
|
||||
|
||||
<Tabs>
|
||||
<Tab title="nhost.toml">
|
||||
```toml
|
||||
[[hasura.jwtSecrets]]
|
||||
type = 'HS256'
|
||||
key = 'f03d5f5a0ed055e3fcbc0a3639405aca0511e6abe6d60e40d1fff610c6248f2a'
|
||||
```
|
||||
</Tab>
|
||||
<Tab title="dashboard">
|
||||

|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
<Note>
|
||||
We recommend using a [secret](/platform/secrets) to configure the key.
|
||||
</Note>
|
||||
|
||||
In addition to `HS256`, you can also use `HS384` and `HS512` for extra security. To quickly generate a key, you can use the following command:
|
||||
|
||||
<Tabs>
|
||||
<Tab title="HS256">
|
||||
```shell
|
||||
openssl rand -base64 32
|
||||
```
|
||||
</Tab>
|
||||
<Tab title="HS384">
|
||||
```shell
|
||||
openssl rand -base64 48
|
||||
```
|
||||
</Tab>
|
||||
<Tab title="HS512">
|
||||
```shell
|
||||
openssl rand -base64 64
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
### Asymmetric Keys
|
||||
|
||||
With asymmetric keys, your project uses a pair of public and private keys for signing and verifying JWTs. The private key, stored securely in the project's configuration, is used to sign the JWTs. The public key, on the other hand, is made available to clients and is used to verify the JWTs. When a client sends a JWT to the server, the server uses the public key to validate the JWT’s signature. If verification is needed in a different service, the public key can be used without compromising security. Since the public key is only used for verification and the private key for signing, sharing the public key is safe and does not jeopardize the security of your JWTs.
|
||||
|
||||
|
||||
Below you can see an example of an asymmetric key configuration:
|
||||
|
||||
<Tabs>
|
||||
<Tab title="nhost.toml">
|
||||
```toml
|
||||
[[hasura.jwtSecrets]]
|
||||
type = "RS256"
|
||||
kid = "bskhwtelkajsd"
|
||||
key = ""
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqSFS8Kx9LuiYpIms+NoZ
|
||||
(ommited for brevity)
|
||||
jwIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
""
|
||||
signingKey = ""
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCpIVLwrH0u6Jik
|
||||
(ommited for brevity)
|
||||
s6fJmz3ZeArPI8KFSI3Q2xqm
|
||||
-----END PRIVATE KEY-----
|
||||
""
|
||||
```
|
||||
</Tab>
|
||||
<Tab title="dashboard">
|
||||

|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
In addition to `RS256`, you can also use `RS384` and `RS512` for extra security. To quickly generate a key pair, you can use the following commands:
|
||||
|
||||
<Tabs>
|
||||
<Tab title="RS256">
|
||||
```shell
|
||||
# Generate a private key
|
||||
openssl genpkey -algorithm RSA -out jwt_private.pem -pkeyopt rsa_keygen_bits:2048
|
||||
|
||||
# Generate a public key from the private key
|
||||
openssl rsa -pubout -in jwt_private.pem -out jwt_public.pem
|
||||
```
|
||||
</Tab>
|
||||
<Tab title="RS384">
|
||||
```shell
|
||||
# Generate a private key
|
||||
openssl genpkey -algorithm RSA -out jwt_private.pem -pkeyopt rsa_keygen_bits:3072
|
||||
|
||||
# Generate a public key from the private key
|
||||
openssl rsa -pubout -in jwt_private.pem -out jwt_public.pem
|
||||
```
|
||||
</Tab>
|
||||
<Tab title="RS512">
|
||||
```shell
|
||||
# Generate a private key
|
||||
openssl genpkey -algorithm RSA -out jwt_private.pem -pkeyopt rsa_keygen_bits:4096
|
||||
|
||||
# Generate a public key from the private key
|
||||
openssl rsa -pubout -in jwt_private.pem -out jwt_public.pem
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
You can then copy the contents of `jwt_private.pem` into the `signingKey` field and the contents of `jwt_public.pem` into the `key` field.
|
||||
|
||||
The `kid` value in your configuration can be any unique string of your choice and must be distinct for each key. It is used to identify the correct key when verifying JWTs through the JWKS endpoint.
|
||||
|
||||
### External Signing
|
||||
|
||||
If you are using a third party service like Auth0 or Clerk you can configure your project to use their JWK endpoint to verify JWTs. Below you can see an example of an external signing configuration:
|
||||
|
||||
<Tabs>
|
||||
<Tab title="nhost.toml">
|
||||
|
||||
```toml
|
||||
[[hasura.jwtSecrets]]
|
||||
jwk_url = "https://mythirdpartyservice.com/jwks.json"
|
||||
```
|
||||
|
||||
Alternatively, you can configure the public key directly:
|
||||
|
||||
```toml
|
||||
[[hasura.jwtSecrets]]
|
||||
type = "RS256"
|
||||
key = ""
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqSFS8Kx9LuiYpIms+NoZ
|
||||
(ommited for brevity)
|
||||
jwIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
""
|
||||
```
|
||||
</Tab>
|
||||
<Tab title="dashboard">
|
||||

|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
<Note>
|
||||
When using external signing the Auth service will be automatically disabled.
|
||||
</Note>
|
||||
|
||||
## Verify a JWT
|
||||
|
||||
|
||||
### Symmetric Keys
|
||||
|
||||
To verify a JWT signed with a symmetric key in a serverless function or third party service you can use code similar to the following:
|
||||
|
||||
```javascript
|
||||
import { Request, Response } from 'express'
|
||||
import process from 'process'
|
||||
import jwt from 'jsonwebtoken'
|
||||
|
||||
const JWT_SECRET = process.env.HASURA_GRAPHQL_JWT_SECRET;
|
||||
|
||||
export default (req: Request, res: Response) => {
|
||||
const authHeader = req.headers.authorization;
|
||||
|
||||
if (!authHeader?.startsWith('Bearer ')) {
|
||||
return res.status(401).json({ error: 'Unauthorized: missing header' });
|
||||
}
|
||||
|
||||
const token = authHeader.split(' ')[1];
|
||||
|
||||
const verifyToken = new Promise((resolve, reject) => {
|
||||
const verifyOptions = {
|
||||
algorithms: ['HS256', 'HS384', 'HS512'],
|
||||
};
|
||||
|
||||
jwt.verify(token, JWT_SECRET, verifyOptions, (err, decoded) => {
|
||||
if (err) reject(err);
|
||||
else resolve(decoded);
|
||||
});
|
||||
});
|
||||
|
||||
verifyToken
|
||||
.then((decoded) => {
|
||||
res.status(200).json({
|
||||
token: decoded,
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
res.status(401).json({ error: `Unauthorized: ${err}` });
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
Keep in mind that you need access to the same key that was used to sign the JWT in order to verify it so this mechanism may not be suitable for all use cases.
|
||||
|
||||
### Asymmetric Keys
|
||||
|
||||
To verify a JWT signed with an asymmetric key you can leverage the JWKS endpoint that is automatically enabled in your project when you configure it to use asymmetric keys. The JWKS endpoint can be found at `https://<subdomain>.auth.<region>.nhost.run/v1/.well-known/jwks.json`. For instance:
|
||||
|
||||
```shell
|
||||
$ curl -s https://local.auth.local.nhost.run/v1/.well-known/jwks.json | jq
|
||||
{
|
||||
"keys": [
|
||||
{
|
||||
"alg": "RS256",
|
||||
"e": "AQAB",
|
||||
"kid": "bskhwtelkajsd",
|
||||
"kty": "RSA",
|
||||
"n": "qSFS8Kx9LuiYpIms-NoZdSIcIgVp3z531bCSq1shx6ZqsKxHyNAjQ9vcYDBcW1gS1q0NFCDWyDLoNyd_lYUDlsc6zjXZAGyjiT1l_Qe9USHjXhT6Yv8SQlVbj8YCYPhYV9g6Bj922gXOmwXpWToHVYK5bjZmq897doksTErKiny6-FlPJvLVp3cpTFuNy6DKkZkIliuZnmf8EMFOVoFuQtNVlDZZZjk9TK9SP-qN1bvFPTdlCxdkA8ws8IkvhFivgfOflLRlzEE4fECEkaC3tZzGzjhPOmV5T8UC8eNz0Ir87nez8_fVyq61ffPkFftfGOjZ4hUfQqn-YW4sH_VTjw",
|
||||
"use": "sig"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
Using the public key from the JWKS endpoint you can verify the JWT in a serverless function using code similar to the following:
|
||||
|
||||
```javascript
|
||||
import { Request, Response } from 'express'
|
||||
import process from 'process'
|
||||
import jwt from 'jsonwebtoken'
|
||||
import jwksClient from 'jwks-rsa'
|
||||
|
||||
const subdomain = process.env.NHOST_SUBDOMAIN;
|
||||
const region = process.env.NHOST_REGION;
|
||||
|
||||
// Initialize the JWKS client
|
||||
const client = jwksClient({
|
||||
jwksUri: `https://${subdomain}.auth.${region}.nhost.run/v1/.well-known/jwks.json`,
|
||||
cache: true,
|
||||
cacheMaxAge: 86400000, // 24 hours cache
|
||||
});
|
||||
|
||||
export default (req: Request, res: Response) => {
|
||||
const authHeader = req.headers.authorization;
|
||||
|
||||
if (!authHeader?.startsWith('Bearer ')) {
|
||||
return res.status(401).json({ error: 'Unauthorized: missing header' });
|
||||
}
|
||||
|
||||
const token = authHeader.split(' ')[1];
|
||||
|
||||
const verifyToken = new Promise((resolve, reject) => {
|
||||
const verifyOptions = {
|
||||
algorithms: ['RS256', 'RS384', 'RS512'],
|
||||
};
|
||||
|
||||
jwt.verify(token, (header, callback) => {
|
||||
client.getSigningKey(header.kid, (err, key) => {
|
||||
if (err) return callback(err);
|
||||
callback(null, key.getPublicKey());
|
||||
});
|
||||
}, verifyOptions, (err, decoded) => {
|
||||
if (err) reject(err);
|
||||
else resolve(decoded);
|
||||
});
|
||||
});
|
||||
|
||||
verifyToken
|
||||
.then((decoded) => {
|
||||
res.status(200).json({
|
||||
token: decoded,
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
res.status(401).json({ error: `Unauthorized: ${err}` });
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
## Custom Claims
|
||||
|
||||
You can attach extra information to your JWTs in the form of custom claims. These claims can be used for authorization purposes in your application. For more details on how to add custom claims to your JWTs and how to use them, see the [Permissions Variables](/guides/api/permissions#permission-variables) documentation.
|
||||
93
docs/guides/auth/sign-in-idtokens.mdx
Normal file
93
docs/guides/auth/sign-in-idtokens.mdx
Normal file
@@ -0,0 +1,93 @@
|
||||
---
|
||||
title: Sign In with ID tokens
|
||||
sidebarTitle: IDTokens
|
||||
description: Learn about ID tokens
|
||||
icon: binary
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
ID tokens are tokens provided by identity providers that contain authenticated user information and are specifically designed for authentication purposes, unlike access tokens which are used for authorization. ID tokens include claims about the user's identity, such as user ID, name, and email, along with metadata like token expiration time and intended audience.
|
||||
|
||||
ID tokens serve as a secure proof that a user has already been authenticated by a trusted identity provider. When someone logs in through their device's built-in authentication (like Sign in with Apple on iOS/macOS or Google Sign-in on Android), the system generates an ID token. This token can then be passed to your authentication service, confirming the user's identity without requiring them to log in again. This streamlined approach works with any OpenID Connect (OIDC) provider, including popular services like Google One Tap sign-in, making the authentication process both secure and user-friendly.
|
||||
|
||||
## Usage
|
||||
|
||||
To use ID tokens, you need to configure supported identity providers (currently [apple](/guides/auth/social/sign-in-apple) and [google](/guides/auth/social/sign-in-google)) and make sure the `audience` is set correctly.
|
||||
|
||||
### Sign in
|
||||
|
||||
Once everything is configured you can use an ID token to authenticate users with just a single call:
|
||||
|
||||
<Tabs>
|
||||
<Tab title="javascript">
|
||||
```js
|
||||
nhost.auth.signInIdToken({
|
||||
provider: 'google', // The provider name, e.g., 'google', 'apple', etc.
|
||||
idToken: '...', // The ID token issued by the provider.
|
||||
nonce: '...' // Optional: The nonce used during token generation.
|
||||
})
|
||||
```
|
||||
|
||||
</Tab>
|
||||
|
||||
{' '}
|
||||
<Tab title="react">See [react docs](/reference/react/use-sign-in-id-token) for details</Tab>
|
||||
|
||||
{' '}
|
||||
<Tab title="vue">See [vue docs](/reference/react/use-sign-in-id-token) for details</Tab>
|
||||
|
||||
<Tab title="dart">
|
||||
```dart
|
||||
nhost.auth.signInIdToken(provider: 'google', idToken: '...', nonce: '...');
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
### Link Provider to existing user
|
||||
|
||||
Similarly to the [Social Connect](/guides/auth/social-connect) feature, you can link an identity provider to an existing user:
|
||||
|
||||
<Tabs>
|
||||
<Tab title="javascript">
|
||||
```js
|
||||
nhost.auth.linkIdToken({
|
||||
provider: 'google', // The provider name, e.g., 'google', 'apple', etc.
|
||||
idToken: '...', // The ID token issued by the provider.
|
||||
nonce: '...' // Optional: The nonce used during token generation.
|
||||
})
|
||||
```
|
||||
|
||||
{' '}
|
||||
<Note>Keep in mind this is an authenticated method so the user must be logged in already.</Note>
|
||||
|
||||
</Tab>
|
||||
|
||||
{' '}
|
||||
<Tab title="react">See [react docs](/reference/react/use-link-id-token) for details</Tab>
|
||||
|
||||
{' '}
|
||||
<Tab title="vue">See [vue docs](/reference/vue/use-link-id-token) for details</Tab>
|
||||
|
||||
<Tab title="dart">
|
||||
```dart
|
||||
nhost.auth.linkIdToken(provider: 'google', idToken: '...', nonce: '...');
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## Examples
|
||||
|
||||
Below you can find some examples on how to extract an ID Token from various identity providers to be used with the Auth service. Keep in mind these are just some examples, use cases and sources are not limited to the examples below.
|
||||
|
||||
### React Native
|
||||
|
||||
#### Apple
|
||||
|
||||
For an example on how to authenticate using "Sign in with Apple" on iOS using React Native you can refer to our [sample component](https://github.com/nhost/nhost/blob/main/examples/react_native/src/components/SignInWithAppleButton.tsx).
|
||||
|
||||
#### Google
|
||||
|
||||
For an example on how to authenticate using "Sign in with Google" on Android using React Native you can refer to our [sample component](https://github.com/nhost/nhost/blob/main/examples/react_native/src/components/SignInWithGoogleButton.tsx).
|
||||
73
docs/guides/auth/sign-in-otp.mdx
Normal file
73
docs/guides/auth/sign-in-otp.mdx
Normal file
@@ -0,0 +1,73 @@
|
||||
---
|
||||
title: Sign In with One-Time Passwords
|
||||
sidebarTitle: One-Time Passwords
|
||||
description: Learn about One-Time Passwords
|
||||
icon: lock-hashtag
|
||||
---
|
||||
|
||||
One-Time Passwords (OTPs) are temporary codes for single use that can be delivered to users via email. OTPs expire after 5 minutes and can only be used once. OTPs can provide a more secure and convenient alternative to regular passwords.
|
||||
|
||||
To use One-Time Passwords, they need to be enabled in the configuration:
|
||||
|
||||
<Tabs>
|
||||
<Tab title="nhost.toml">
|
||||
```toml
|
||||
[auth.method.otp.email]
|
||||
enabled = true
|
||||
```
|
||||
</Tab>
|
||||
<Tab title="Dashboard">
|
||||

|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
After the functionality has been enabled the flow is as follows:
|
||||
|
||||
1. User requests an OTP:
|
||||
|
||||
<Tabs>
|
||||
<Tab title="javascript">
|
||||
```js
|
||||
nhost.auth.signInEmailOTP('user@example.com')
|
||||
```
|
||||
</Tab>
|
||||
|
||||
<Tab title="react">
|
||||
See [react docs](/reference/react/use-sign-in-email-otp) for details
|
||||
</Tab>
|
||||
|
||||
<Tab title="vue">
|
||||
See [vue docs](/reference/vue/use-sign-in-email-otp) for details
|
||||
</Tab>
|
||||
|
||||
<Tab title="dart">
|
||||
```dart
|
||||
nhost.auth.signInEmailOTP(email: "user@example.com");
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
2. User receives an email with the OTP
|
||||
3. User enters the OTP
|
||||
|
||||
<Tabs>
|
||||
<Tab title="javascript">
|
||||
```js
|
||||
nhost.auth.verifyEmailOTP('user@example.com', '123456')
|
||||
```
|
||||
</Tab>
|
||||
|
||||
<Tab title="react">
|
||||
See [react docs](/reference/react/use-sign-in-email-otp) for details
|
||||
</Tab>
|
||||
|
||||
<Tab title="vue">
|
||||
See [vue docs](/reference/vue/use-sign-in-email-otp) for details
|
||||
</Tab>
|
||||
|
||||
<Tab title="dart">
|
||||
```dart
|
||||
nhost.auth.verifyEmailOTP(email: "user@example.com", otp: "123456");
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
@@ -4,6 +4,78 @@ description: List of available extensions with Nhost Postgres.
|
||||
icon: grid
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
In the table below you can find a list of available extensions with Nhost Postgres:
|
||||
|
||||
| name | version | comment |
|
||||
| -----------------------------|---------|--------------------------------------------------------------------------------------------------------------------- |
|
||||
| address_standardizer | 3.5.0 | Used to parse an address into constituent elements. Generally used to support geocoding address normalization step. |
|
||||
| address_standardizer_data_us | 3.5.0 | Address Standardizer US dataset example |
|
||||
| adminpack | 2.1 | administrative functions for PostgreSQL |
|
||||
| amcheck | 1.3 | functions for verifying relation integrity |
|
||||
| autoinc | 1.0 | functions for autoincrementing fields |
|
||||
| bloom | 1.0 | bloom access method - signature file based index |
|
||||
| btree_gin | 1.3 | support for indexing common datatypes in GIN |
|
||||
| btree_gist | 1.6 | support for indexing common datatypes in GiST |
|
||||
| citext | 1.6 | data type for case-insensitive character strings |
|
||||
| cube | 1.5 | data type for multidimensional cubes |
|
||||
| dblink | 1.2 | connect to other PostgreSQL databases from within a database |
|
||||
| dict_int | 1.0 | text search dictionary template for integers |
|
||||
| dict_xsyn | 1.0 | text search dictionary template for extended synonym processing |
|
||||
| earthdistance | 1.1 | calculate great-circle distances on the surface of the Earth |
|
||||
| file_fdw | 1.0 | foreign-data wrapper for flat file access |
|
||||
| fuzzystrmatch | 1.1 | determine similarities and distance between strings |
|
||||
| hstore | 1.8 | data type for storing sets of (key, value) pairs |
|
||||
| http | 1.6 | HTTP client for PostgreSQL, allows web page retrieval inside the database. |
|
||||
| hypopg | 1.4.1 | Hypothetical indexes for PostgreSQL |
|
||||
| insert_username | 1.0 | functions for tracking who changed a table |
|
||||
| intagg | 1.1 | integer aggregator and enumerator (obsolete) |
|
||||
| intarray | 1.5 | functions, operators, and index support for 1-D arrays of integers |
|
||||
| ip4r | 2.4 | |
|
||||
| isn | 1.2 | data types for international product numbering standards |
|
||||
| lo | 1.1 | Large Object maintenance |
|
||||
| ltree | 1.2 | data type for hierarchical tree-like structures |
|
||||
| moddatetime | 1.0 | functions for tracking last modification time |
|
||||
| old_snapshot | 1.0 | utilities in support of old_snapshot_threshold |
|
||||
| pageinspect | 1.9 | inspect the contents of database pages at a low level |
|
||||
| pg_buffercache | 1.3 | examine the shared buffer cache |
|
||||
| pg_cron | 1.6 | Job scheduler for PostgreSQL |
|
||||
| pg_freespacemap | 1.2 | examine the free space map (FSM) |
|
||||
| pg_hashids | 1.3 | pg_hashids |
|
||||
| pg_ivm | 1.9 | incremental view maintenance on PostgreSQL |
|
||||
| pg_prewarm | 1.2 | prewarm relation data |
|
||||
| pg_repack | 1.5.1 | Reorganize tables in PostgreSQL databases with minimal locks |
|
||||
| pg_squeeze | 1.7 | A tool to remove unused space from a relation. |
|
||||
| pg_stat_statements | 1.9 | track planning and execution statistics of all SQL statements executed |
|
||||
| pg_surgery | 1.0 | extension to perform surgery on a damaged relation |
|
||||
| pg_trgm | 1.6 | text similarity measurement and index searching based on trigrams |
|
||||
| pg_visibility | 1.2 | examine the visibility map (VM) and page-level visibility info |
|
||||
| pgcrypto | 1.3 | cryptographic functions |
|
||||
| pgrowlocks | 1.2 | show row-level locking information |
|
||||
| pgstattuple | 1.5 | show tuple-level statistics |
|
||||
| plpgsql | 1.0 | PL/pgSQL procedural language |
|
||||
| postgis | 3.5.0 | PostGIS geometry and geography spatial types and functions |
|
||||
| postgis_raster | 3.5.0 | PostGIS raster types and functions |
|
||||
| postgis_tiger_geocoder | 3.5.0 | PostGIS tiger geocoder and reverse geocoder |
|
||||
| postgis_topology | 3.5.0 | PostGIS topology spatial types and functions |
|
||||
| postgres_fdw | 1.1 | foreign-data wrapper for remote PostgreSQL servers |
|
||||
| refint | 1.0 | functions for implementing referential integrity (obsolete) |
|
||||
| seg | 1.4 | data type for representing line segments or floating-point intervals |
|
||||
| sslinfo | 1.2 | information about SSL certificates |
|
||||
| tablefunc | 1.0 | functions that manipulate whole tables, including crosstab |
|
||||
| tcn | 1.0 | Triggered change notifications |
|
||||
| timescaledb | 2.17.2 | Enables scalable inserts and complex queries for time-series data (Community Edition) |
|
||||
| tsm_system_rows | 1.0 | TABLESAMPLE method which accepts number of rows as a limit |
|
||||
| tsm_system_time | 1.0 | TABLESAMPLE method which accepts time in milliseconds as a limit |
|
||||
| unaccent | 1.1 | text search dictionary that removes accents |
|
||||
| uuid-ossp | 1.1 | generate universally unique identifiers (UUIDs) |
|
||||
| vector | 0.8.0 | vector data type and ivfflat and hnsw access methods |
|
||||
| xml2 | 1.1 | XPath querying and XSLT |
|
||||
|
||||
In addition, you can find more information about some of the extensions below
|
||||
|
||||
|
||||
## hypopg
|
||||
|
||||
HypoPG is a PostgreSQL extension adding support for hypothetical indexes.
|
||||
@@ -205,6 +277,31 @@ DROP EXTENSION pg_ivm;
|
||||
|
||||
- [GitHub](https://github.com/sraoss/pg_ivm)
|
||||
|
||||
## pg_repack
|
||||
|
||||
pg_repack is a PostgreSQL extension which lets you remove bloat from tables and indexes, and optionally restore the physical order of clustered indexes. Unlike CLUSTER and VACUUM FULL it works online, without holding an exclusive lock on the processed tables during processing. pg_repack is efficient to boot, with performance comparable to using CLUSTER directly.
|
||||
|
||||
### Managing
|
||||
|
||||
To install the extension you can create a migration with the following contents:
|
||||
|
||||
```sql SQL
|
||||
SET ROLE postgres;
|
||||
CREATE EXTENSION pg_repack;
|
||||
```
|
||||
In addition, you may need to configure the WAL level and replication slots. Check the official documentation for details.
|
||||
|
||||
To uninstall it, you can use the following migration:
|
||||
|
||||
```sql SQL
|
||||
SET ROLE postgres;
|
||||
DROP EXTENSION pg_repack;
|
||||
```
|
||||
|
||||
### Resources
|
||||
|
||||
- [GitHub](https://github.com/cybertec-postgresql/pg_squeeze)
|
||||
|
||||
## pg_squeeze
|
||||
|
||||
PostgreSQL extension that removes unused space from a table and optionally sorts tuples according to particular index (as if CLUSTER command was executed concurrently with regular reads / writes). In fact we try to replace pg_repack extension.
|
||||
|
||||
BIN
docs/images/guides/auth/jwt/asymmetric.png
Normal file
BIN
docs/images/guides/auth/jwt/asymmetric.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
BIN
docs/images/guides/auth/jwt/external.png
Normal file
BIN
docs/images/guides/auth/jwt/external.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 994 KiB |
BIN
docs/images/guides/auth/jwt/symmetric.png
Normal file
BIN
docs/images/guides/auth/jwt/symmetric.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 984 KiB |
BIN
docs/images/guides/auth/sign-in-otp.png
Normal file
BIN
docs/images/guides/auth/sign-in-otp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1014 KiB |
126
docs/main.go
Normal file
126
docs/main.go
Normal file
@@ -0,0 +1,126 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
const tpl = `---
|
||||
title: "%s"
|
||||
openapi: %s %s
|
||||
---`
|
||||
|
||||
const authReferencePath = "reference/auth"
|
||||
|
||||
type OpenAPIMinimal struct {
|
||||
Paths map[string]map[string]any
|
||||
}
|
||||
|
||||
type Endpoint struct {
|
||||
Method string
|
||||
Path string
|
||||
}
|
||||
|
||||
func (e Endpoint) Filepath() string {
|
||||
return authReferencePath + "/" + e.Method + strings.ReplaceAll(e.Path, "/", "-") + ".mdx"
|
||||
}
|
||||
|
||||
func (e Endpoint) Content() string {
|
||||
return fmt.Sprintf(tpl, e.Path, e.Method, e.Path)
|
||||
}
|
||||
|
||||
func (e Endpoint) Mintlify() string {
|
||||
return ` "` + strings.Replace(e.Filepath(), ".mdx", "", 1) + `",`
|
||||
}
|
||||
|
||||
type Endpoints []Endpoint
|
||||
|
||||
func (e Endpoints) Sort() {
|
||||
slices.SortFunc(e, func(a, b Endpoint) int {
|
||||
if a.Path == b.Path {
|
||||
return strings.Compare(a.Method, b.Method)
|
||||
}
|
||||
return strings.Compare(a.Path, b.Path)
|
||||
})
|
||||
}
|
||||
|
||||
func funcReadOpenAPIFile(filepath string) (*OpenAPIMinimal, error) {
|
||||
b, err := os.ReadFile(filepath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read file: %w", err)
|
||||
}
|
||||
|
||||
var oam *OpenAPIMinimal
|
||||
if err := yaml.Unmarshal(b, &oam); err != nil {
|
||||
return nil, fmt.Errorf("failed to unmarshal yaml: %w", err)
|
||||
}
|
||||
|
||||
return oam, nil
|
||||
}
|
||||
|
||||
func processOAMFiles(oam *OpenAPIMinimal) (Endpoints, error) {
|
||||
endpoints := make(Endpoints, 0, len(oam.Paths)*2)
|
||||
|
||||
for path, methods := range oam.Paths {
|
||||
for method := range methods {
|
||||
e := Endpoint{Method: method, Path: path}
|
||||
endpoints = append(endpoints, e)
|
||||
|
||||
if err := os.WriteFile(e.Filepath(), []byte(e.Content()), 0o644); err != nil {
|
||||
return nil, fmt.Errorf("failed to write file: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return endpoints, nil
|
||||
}
|
||||
|
||||
func process() error {
|
||||
if err := os.RemoveAll(authReferencePath); err != nil {
|
||||
return fmt.Errorf("failed to remove directory: %w", err)
|
||||
}
|
||||
|
||||
if err := os.Mkdir(authReferencePath, 0o755); err != nil {
|
||||
return fmt.Errorf("failed to create directory: %w", err)
|
||||
}
|
||||
|
||||
oam, err := funcReadOpenAPIFile("reference/openapi-auth.yaml")
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to read openapi-auth.yaml file: %w", err)
|
||||
}
|
||||
|
||||
endpoints, err := processOAMFiles(oam)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to process OAM files: %w", err)
|
||||
}
|
||||
|
||||
oamOld, err := funcReadOpenAPIFile("reference/openapi-auth-old.yaml")
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to read openapi-auth-old.yaml file: %w", err)
|
||||
}
|
||||
|
||||
endpointsOld, err := processOAMFiles(oamOld)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to process OAM files: %w", err)
|
||||
}
|
||||
|
||||
endpoints = append(endpoints, endpointsOld...)
|
||||
endpoints.Sort()
|
||||
|
||||
for _, e := range endpoints {
|
||||
fmt.Println(e.Mintlify())
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
if err := process(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
145
docs/mint.json
145
docs/mint.json
@@ -1,7 +1,11 @@
|
||||
{
|
||||
"$schema": "https://mintlify.com/schema.json",
|
||||
"name": "Documentation",
|
||||
"openapi": ["reference/openapi-auth.yaml", "reference/openapi-storage.yaml"],
|
||||
"openapi": [
|
||||
"reference/openapi-auth.yaml",
|
||||
"reference/openapi-auth-old.yaml",
|
||||
"reference/openapi-storage.yaml"
|
||||
],
|
||||
"logo": {
|
||||
"dark": "/logo/dark.svg",
|
||||
"light": "/logo/light.svg"
|
||||
@@ -135,6 +139,7 @@
|
||||
"pages": [
|
||||
"guides/auth/overview",
|
||||
"guides/auth/users",
|
||||
"guides/auth/jwt",
|
||||
{
|
||||
"group": "Social Sign In",
|
||||
"icon": "at",
|
||||
@@ -153,9 +158,11 @@
|
||||
},
|
||||
"guides/auth/social-connect",
|
||||
"guides/auth/sign-in-email-password",
|
||||
"guides/auth/sign-in-otp",
|
||||
"guides/auth/sign-in-magic-link",
|
||||
"guides/auth/sign-in-phone-number",
|
||||
"guides/auth/sign-in-webauthn",
|
||||
"guides/auth/sign-in-idtokens",
|
||||
"guides/auth/elevated-permissions",
|
||||
"guides/auth/bot-protection",
|
||||
"guides/auth/email-templates",
|
||||
@@ -176,10 +183,7 @@
|
||||
},
|
||||
{
|
||||
"group": "Functions",
|
||||
"pages": [
|
||||
"guides/functions/overview",
|
||||
"guides/functions/runtimes"
|
||||
]
|
||||
"pages": ["guides/functions/overview", "guides/functions/runtimes"]
|
||||
},
|
||||
{
|
||||
"group": "Run",
|
||||
@@ -213,76 +217,46 @@
|
||||
"group": "Authentication",
|
||||
"icon": "users",
|
||||
"pages": [
|
||||
{
|
||||
"group": "Email and Password",
|
||||
"icon": "envelope",
|
||||
"pages": [
|
||||
"reference/auth/sign-up-email-and-password",
|
||||
"reference/auth/sign-in-email-and-password"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Passwordless",
|
||||
"icon": "message-sms",
|
||||
"pages": [
|
||||
"reference/auth/sign-in-email-passwordless",
|
||||
"reference/auth/sign-in-sms-passwordless",
|
||||
"reference/auth/sign-in-sms-passwordless-otp"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "OAuth",
|
||||
"icon": "at",
|
||||
"pages": [
|
||||
"reference/auth/sign-in-oauth-provider",
|
||||
"reference/auth/oauth-callback-url-that-will-be-used-by-the-oauth-provider-to-redirect-to-the-client-application-attention:-all-providers-are-using-a-get-operation-except-apple-and-azure-ad-that-use-post"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "WebAuthn",
|
||||
"icon": "atom",
|
||||
"pages": [
|
||||
"reference/auth/sign-up-using-email-via-fido2-webauthn-authentication",
|
||||
"reference/auth/verfiy-fido2-webauthn-authentication-and-complete-signup",
|
||||
"reference/auth/sign-in-using-email-via-fido2-webauthn-authentication",
|
||||
"reference/auth/verfiy-fido2-webauthn-authentication-using-public-key-cryptography",
|
||||
"reference/auth/elevate-webauthn",
|
||||
"reference/auth/elevate-webauthn-verify"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Anonymous",
|
||||
"icon": "luchador-mask",
|
||||
"pages": [
|
||||
"reference/auth/sign-in-anonymous",
|
||||
"reference/auth/deanonymize-an-anonymous-user-in-adding-missing-email-or-email+password-depending-on-the-chosen-authentication-method-will-send-a-confirmation-email-if-the-server-is-configured-to-do-so"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "MFA",
|
||||
"icon": "message-sms",
|
||||
"pages": [
|
||||
"reference/auth/generate-a-secret-to-request-the-activation-of-time-based-one-time-password-totp-multi-factor-authentication",
|
||||
"reference/auth/sign-in-totp",
|
||||
"reference/auth/activatedeactivate-multi-factor-authentication"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "User",
|
||||
"icon": "user",
|
||||
"pages": [
|
||||
"reference/auth/change-the-current-users-email",
|
||||
"reference/auth/send-an-email-asking-the-user-to-reset-their-password",
|
||||
"reference/auth/send-an-email-to-verify-the-account",
|
||||
"reference/auth/set-a-new-password",
|
||||
"reference/auth/get-user-information",
|
||||
"reference/auth/refresh-the-oauth-access-tokens-of-a-given-user-you-must-be-an-admin-to-perform-this-operation",
|
||||
"reference/auth/initialize-adding-of-a-new-webauthn-security-key-device-browser",
|
||||
"reference/auth/verfiy-adding-of-a-new-webauth-security-key-device-browser",
|
||||
"reference/auth/create-personal-access-token-pat"
|
||||
]
|
||||
},
|
||||
"reference/auth/sign-out"
|
||||
"reference/auth/get-.well-known-jwks.json",
|
||||
"reference/auth/post-elevate-webauthn",
|
||||
"reference/auth/post-elevate-webauthn-verify",
|
||||
"reference/auth/get-healthz",
|
||||
"reference/auth/head-healthz",
|
||||
"reference/auth/post-link-idtoken",
|
||||
"reference/auth/get-mfa-totp-generate",
|
||||
"reference/auth/post-pat",
|
||||
"reference/auth/post-signin-anonymous",
|
||||
"reference/auth/post-signin-email-password",
|
||||
"reference/auth/post-signin-idtoken",
|
||||
"reference/auth/post-signin-mfa-totp",
|
||||
"reference/auth/post-signin-otp-email",
|
||||
"reference/auth/post-signin-otp-email-verify",
|
||||
"reference/auth/post-signin-passwordless-email",
|
||||
"reference/auth/post-signin-passwordless-sms",
|
||||
"reference/auth/post-signin-passwordless-sms-otp",
|
||||
"reference/auth/post-signin-pat",
|
||||
"reference/auth/get-signin-provider-{provider}",
|
||||
"reference/auth/get-signin-provider-{provider}-callback",
|
||||
"reference/auth/post-signin-webauthn",
|
||||
"reference/auth/post-signin-webauthn-verify",
|
||||
"reference/auth/post-signout",
|
||||
"reference/auth/post-signup-email-password",
|
||||
"reference/auth/post-signup-webauthn",
|
||||
"reference/auth/post-signup-webauthn-verify",
|
||||
"reference/auth/post-token",
|
||||
"reference/auth/post-token-verify",
|
||||
"reference/auth/get-user",
|
||||
"reference/auth/post-user-deanonymize",
|
||||
"reference/auth/post-user-email-change",
|
||||
"reference/auth/post-user-email-send-verification-email",
|
||||
"reference/auth/post-user-mfa",
|
||||
"reference/auth/post-user-password",
|
||||
"reference/auth/post-user-password-reset",
|
||||
"reference/auth/post-user-provider-tokens",
|
||||
"reference/auth/post-user-webauthn-add",
|
||||
"reference/auth/post-user-webauthn-verify",
|
||||
"reference/auth/get-verify",
|
||||
"reference/auth/get-version"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -376,7 +350,11 @@
|
||||
"reference/javascript/auth/sign-up",
|
||||
"reference/javascript/auth/add-security-key",
|
||||
"reference/javascript/auth/elevate-email-security-key",
|
||||
"reference/javascript/auth/connect-provider"
|
||||
"reference/javascript/auth/connect-provider",
|
||||
"reference/javascript/auth/sign-in-email-otp",
|
||||
"reference/javascript/auth/verify-email-otp",
|
||||
"reference/javascript/auth/sign-in-id-token",
|
||||
"reference/javascript/auth/link-id-token"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -459,7 +437,10 @@
|
||||
"reference/react/use-user-id",
|
||||
"reference/react/use-user-is-anonymous",
|
||||
"reference/react/use-user-locale",
|
||||
"reference/react/use-user-roles"
|
||||
"reference/react/use-user-roles",
|
||||
"reference/react/use-sign-in-email-otp",
|
||||
"reference/react/use-sign-in-id-token",
|
||||
"reference/react/use-link-id-token"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -506,7 +487,10 @@
|
||||
"reference/nextjs/use-user-id",
|
||||
"reference/nextjs/use-user-is-anonymous",
|
||||
"reference/nextjs/use-user-locale",
|
||||
"reference/nextjs/use-user-roles"
|
||||
"reference/nextjs/use-user-roles",
|
||||
"reference/nextjs/use-sign-in-email-otp",
|
||||
"reference/nextjs/use-sign-in-id-token",
|
||||
"reference/nextjs/use-link-id-token"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -548,7 +532,10 @@
|
||||
"reference/vue/use-add-security-key",
|
||||
"reference/vue/use-elevate-security-key-email",
|
||||
"reference/vue/use-sign-in-email-security-key",
|
||||
"reference/vue/use-sign-up-email-security-key"
|
||||
"reference/vue/use-sign-up-email-security-key",
|
||||
"reference/vue/use-sign-in-email-otp",
|
||||
"reference/vue/use-sign-in-id-token",
|
||||
"reference/vue/use-link-id-token"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/docs",
|
||||
"version": "2.21.0",
|
||||
"version": "2.23.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "mintlify dev"
|
||||
|
||||
@@ -13,13 +13,17 @@ Combined with a powerful **Permission Rules** system, Nhost Auth offers everythi
|
||||
<CardGroup cols={4}>
|
||||
<Card title="Email and Password" icon="square-1" href="../guides/auth/sign-in-email-password">
|
||||
</Card>
|
||||
<Card title="Magic Link" icon="square-2" href="../guides/auth/sign-in-magic-link">
|
||||
<Card title="One-Time Passwords (OTP)" icon="square-2" href="../guides/auth/sign-in-otp">
|
||||
</Card>
|
||||
<Card title="Phone Number (SMS)" icon="square-3" href="../guides/auth/sign-in-phone-number">
|
||||
<Card title="Magic Link" icon="square-3" href="../guides/auth/sign-in-magic-link">
|
||||
</Card>
|
||||
<Card title="Security Keys (WebAuthn)" icon="square-4" href="../guides/auth/sign-in-webauthn">
|
||||
<Card title="Phone Number (SMS)" icon="square-4" href="../guides/auth/sign-in-phone-number">
|
||||
</Card>
|
||||
<Card title="Elevated Permissions" icon="square-5" href="../guides/auth/elevated-permissions">
|
||||
<Card title="Security Keys (WebAuthn)" icon="square-5" href="../guides/auth/sign-in-webauthn">
|
||||
</Card>
|
||||
<Card title="ID Tokens" icon="square-6" href="../guides/auth/sign-in-idtokens">
|
||||
</Card>
|
||||
<Card title="Elevated Permissions" icon="square-7" href="../guides/auth/elevated-permissions">
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
|
||||
4
docs/reference/auth/get-.well-known-jwks.json.mdx
Normal file
4
docs/reference/auth/get-.well-known-jwks.json.mdx
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "/.well-known/jwks.json"
|
||||
openapi: get /.well-known/jwks.json
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/healthz"
|
||||
openapi: get /healthz
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/mfa/totp/generate"
|
||||
openapi: get /mfa/totp/generate
|
||||
---
|
||||
@@ -1,4 +1,4 @@
|
||||
---
|
||||
title: "/signin/provider/{provider}/callback"
|
||||
openapi: get /signin/provider/{provider}/callback
|
||||
sidebarTitle: Sign In Callback
|
||||
---
|
||||
---
|
||||
@@ -1,4 +1,4 @@
|
||||
---
|
||||
title: "/signin/provider/{provider}"
|
||||
openapi: get /signin/provider/{provider}
|
||||
sidebarTitle: Sign In
|
||||
---
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/user"
|
||||
openapi: get /user
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/verify"
|
||||
openapi: get /verify
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/version"
|
||||
openapi: get /version
|
||||
---
|
||||
4
docs/reference/auth/head-healthz.mdx
Normal file
4
docs/reference/auth/head-healthz.mdx
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "/healthz"
|
||||
openapi: head /healthz
|
||||
---
|
||||
@@ -1,4 +1,4 @@
|
||||
---
|
||||
title: "/elevate/webauthn/verify"
|
||||
openapi: post /elevate/webauthn/verify
|
||||
sidebarTitle: Elevate Verify
|
||||
---
|
||||
---
|
||||
@@ -1,4 +1,4 @@
|
||||
---
|
||||
title: "/elevate/webauthn"
|
||||
openapi: post /elevate/webauthn
|
||||
sidebarTitle: Elevate
|
||||
---
|
||||
---
|
||||
4
docs/reference/auth/post-link-idtoken.mdx
Normal file
4
docs/reference/auth/post-link-idtoken.mdx
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "/link/idtoken"
|
||||
openapi: post /link/idtoken
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/pat"
|
||||
openapi: post /pat
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/signin/anonymous"
|
||||
openapi: post /signin/anonymous
|
||||
---
|
||||
@@ -1,4 +1,4 @@
|
||||
---
|
||||
title: "/signin/email-password"
|
||||
openapi: post /signin/email-password
|
||||
sidebarTitle: 'Sign In'
|
||||
---
|
||||
---
|
||||
4
docs/reference/auth/post-signin-idtoken.mdx
Normal file
4
docs/reference/auth/post-signin-idtoken.mdx
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "/signin/idtoken"
|
||||
openapi: post /signin/idtoken
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/signin/mfa/totp"
|
||||
openapi: post /signin/mfa/totp
|
||||
---
|
||||
4
docs/reference/auth/post-signin-otp-email-verify.mdx
Normal file
4
docs/reference/auth/post-signin-otp-email-verify.mdx
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "/signin/otp/email/verify"
|
||||
openapi: post /signin/otp/email/verify
|
||||
---
|
||||
4
docs/reference/auth/post-signin-otp-email.mdx
Normal file
4
docs/reference/auth/post-signin-otp-email.mdx
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "/signin/otp/email"
|
||||
openapi: post /signin/otp/email
|
||||
---
|
||||
@@ -1,4 +1,4 @@
|
||||
---
|
||||
title: "/signin/passwordless/email"
|
||||
openapi: post /signin/passwordless/email
|
||||
sidebarTitle: Sign In Email
|
||||
---
|
||||
---
|
||||
@@ -1,4 +1,4 @@
|
||||
---
|
||||
title: "/signin/passwordless/sms/otp"
|
||||
openapi: post /signin/passwordless/sms/otp
|
||||
sidebarTitle: Sign In SMS Verify OTP
|
||||
---
|
||||
---
|
||||
@@ -1,4 +1,4 @@
|
||||
---
|
||||
title: "/signin/passwordless/sms"
|
||||
openapi: post /signin/passwordless/sms
|
||||
sidebarTitle: Sign In SMS
|
||||
---
|
||||
---
|
||||
4
docs/reference/auth/post-signin-pat.mdx
Normal file
4
docs/reference/auth/post-signin-pat.mdx
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "/signin/pat"
|
||||
openapi: post /signin/pat
|
||||
---
|
||||
@@ -1,4 +1,4 @@
|
||||
---
|
||||
title: "/signin/webauthn/verify"
|
||||
openapi: post /signin/webauthn/verify
|
||||
sidebarTitle: Sign In Verify
|
||||
---
|
||||
---
|
||||
@@ -1,4 +1,4 @@
|
||||
---
|
||||
title: "/signin/webauthn"
|
||||
openapi: post /signin/webauthn
|
||||
sidebarTitle: 'Sign In'
|
||||
---
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/signout"
|
||||
openapi: post /signout
|
||||
---
|
||||
@@ -1,4 +1,4 @@
|
||||
---
|
||||
title: "/signup/email-password"
|
||||
openapi: post /signup/email-password
|
||||
sidebarTitle: Sign Up
|
||||
---
|
||||
---
|
||||
@@ -1,4 +1,4 @@
|
||||
---
|
||||
title: "/signup/webauthn/verify"
|
||||
openapi: post /signup/webauthn/verify
|
||||
sidebarTitle: Sign Up Verify
|
||||
---
|
||||
---
|
||||
@@ -1,4 +1,4 @@
|
||||
---
|
||||
title: "/signup/webauthn"
|
||||
openapi: post /signup/webauthn
|
||||
sidebarTitle: Sign Up
|
||||
---
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/token/verify"
|
||||
openapi: post /token/verify
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/token"
|
||||
openapi: post /token
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/user/deanonymize"
|
||||
openapi: post /user/deanonymize
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/user/email/change"
|
||||
openapi: post /user/email/change
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/user/email/send-verification-email"
|
||||
openapi: post /user/email/send-verification-email
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/user/mfa"
|
||||
openapi: post /user/mfa
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/user/password/reset"
|
||||
openapi: post /user/password/reset
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/user/password"
|
||||
openapi: post /user/password
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/user/provider/tokens"
|
||||
openapi: post /user/provider/tokens
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/user/webauthn/add"
|
||||
openapi: post /user/webauthn/add
|
||||
---
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
title: "/user/webauthn/verify"
|
||||
openapi: post /user/webauthn/verify
|
||||
---
|
||||
28
docs/reference/javascript/auth/link-id-token.mdx
Normal file
28
docs/reference/javascript/auth/link-id-token.mdx
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: linkIdToken()
|
||||
sidebarTitle: linkIdToken()
|
||||
---
|
||||
|
||||
Use `nhost.auth.linkIdToken` to link a user account with the provider's account using an ID token
|
||||
|
||||
```ts
|
||||
nhost.auth.linkIdToken({
|
||||
provider: 'google', // The provider name, e.g., 'google', 'apple', etc.
|
||||
idToken: '...', // The ID token issued by the provider.
|
||||
nonce: '...' // Optional: The nonce used during token generation.
|
||||
})
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">params</span>** <span className="optional-status">required</span> [`LinkIdTokenParams`](/reference/javascript/auth/types/link-id-token-params)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :------------------------------------------------------------------------------------------ | :------------------------------------------------------ | :------: | :---- |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>idToken</span> | <code>string</code> | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>provider</span> | [`Provider`](/reference/javascript/auth/types/provider) | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>nonce</span> | <code>string</code> | | |
|
||||
|
||||
---
|
||||
33
docs/reference/javascript/auth/sign-in-email-otp.mdx
Normal file
33
docs/reference/javascript/auth/sign-in-email-otp.mdx
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
title: signInEmailOTP()
|
||||
sidebarTitle: signInEmailOTP()
|
||||
---
|
||||
|
||||
Use `nhost.auth.signInEmailOTP` to sign in with an email one-time password (OTP).
|
||||
|
||||
```ts
|
||||
nhost.auth.signInEmailOTP('user@example.com')
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">email</span>** <span className="optional-status">required</span> <code>string</code>
|
||||
|
||||
The email address to send the OTP to
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">options</span>** <span className="optional-status">optional</span> [`EmailOTPOptions`](/reference/javascript/auth/types/email-otp-options)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :----------------------------------------------------------------------------------------------- | :----------------------------------------- | :------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| <span className="parameter-name"><span className="light-grey">options.</span>redirectTo</span> | <code>string</code> | | Redirection path in the client application that will be used in the link in the verification email. For instance, if you want to redirect to `https://myapp.com/success`, the `redirectTo` value is `'/success'`. |
|
||||
| <span className="parameter-name"><span className="light-grey">options.</span>metadata</span> | <code>Record<string, unknown></code> | | Custom additional user information stored in the `metadata` column. Can be any JSON object. |
|
||||
| <span className="parameter-name"><span className="light-grey">options.</span>displayName</span> | <code>string</code> | | Display name of the user. If not provided, it will use the display name given by the social provider (Oauth) used on registration, or the email address otherwise. |
|
||||
| <span className="parameter-name"><span className="light-grey">options.</span>defaultRole</span> | <code>string</code> | | Default role of the user. Must be part of the default allowed roles defined in Hasura Auth. |
|
||||
| <span className="parameter-name"><span className="light-grey">options.</span>allowedRoles</span> | <code>Array<string></code> | | Allowed roles of the user. Must be a subset of the default allowed roles defined in Hasura Auth. |
|
||||
| <span className="parameter-name"><span className="light-grey">options.</span>locale</span> | <code>string</code> | | Locale of the user, in two digits |
|
||||
|
||||
---
|
||||
28
docs/reference/javascript/auth/sign-in-id-token.mdx
Normal file
28
docs/reference/javascript/auth/sign-in-id-token.mdx
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: signInIdToken()
|
||||
sidebarTitle: signInIdToken()
|
||||
---
|
||||
|
||||
Use `nhost.auth.signInIdToken` to sign in a user with the provider's account using an ID token
|
||||
|
||||
```ts
|
||||
nhost.auth.signInIdToken({
|
||||
provider: 'google', // The provider name, e.g., 'google', 'apple', etc.
|
||||
idToken: '...', // The ID token issued by the provider.
|
||||
nonce: '...' // Optional: The nonce used during token generation.
|
||||
})
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">params</span>** <span className="optional-status">required</span> [`SignInIdTokenParams`](/reference/javascript/auth/types/sign-in-id-token-params)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :------------------------------------------------------------------------------------------ | :------------------------------------------------------ | :------: | :---- |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>idToken</span> | <code>string</code> | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>provider</span> | [`Provider`](/reference/javascript/auth/types/provider) | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>nonce</span> | <code>string</code> | | |
|
||||
|
||||
---
|
||||
48
docs/reference/javascript/auth/types/email-otp-options.mdx
Normal file
48
docs/reference/javascript/auth/types/email-otp-options.mdx
Normal file
@@ -0,0 +1,48 @@
|
||||
---
|
||||
title: EmailOTPOptions
|
||||
sidebarTitle: EmailOTPOptions
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `EmailOTPOptions`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">locale</span>** <span className="optional-status">optional</span> <code>string</code>
|
||||
|
||||
Locale of the user, in two digits
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">allowedRoles</span>** <span className="optional-status">optional</span> <code>Array<string></code>
|
||||
|
||||
Allowed roles of the user. Must be a subset of the default allowed roles defined in Hasura Auth.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">defaultRole</span>** <span className="optional-status">optional</span> <code>string</code>
|
||||
|
||||
Default role of the user. Must be part of the default allowed roles defined in Hasura Auth.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">displayName</span>** <span className="optional-status">optional</span> <code>string</code>
|
||||
|
||||
Display name of the user. If not provided, it will use the display name given by the social provider (Oauth) used on registration, or the email address otherwise.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">metadata</span>** <span className="optional-status">optional</span> <code>Record<string, unknown></code>
|
||||
|
||||
Custom additional user information stored in the `metadata` column. Can be any JSON object.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">redirectTo</span>** <span className="optional-status">optional</span> <code>string</code>
|
||||
|
||||
Redirection path in the client application that will be used in the link in the verification email.
|
||||
For instance, if you want to redirect to `https://myapp.com/success`, the `redirectTo` value is `'/success'`.
|
||||
|
||||
---
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title: LinkIdTokenHandlerParams
|
||||
sidebarTitle: LinkIdTokenHandlerParams
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `LinkIdTokenHandlerParams`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">idToken</span>** <span className="optional-status">required</span> <code>string</code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">provider</span>** <span className="optional-status">required</span> [`Provider`](/reference/javascript/auth/types/provider)
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">nonce</span>** <span className="optional-status">optional</span> <code>string</code>
|
||||
|
||||
---
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
title: LinkIdTokenHandlerResult
|
||||
sidebarTitle: LinkIdTokenHandlerResult
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `LinkIdTokenHandlerResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
**`@returns`**
|
||||
|
||||
`true` if an error occurred
|
||||
|
||||
**`@depreacted`**
|
||||
|
||||
use `!isSuccess` or `!!error` instead
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> <code>null | [`AuthErrorPayload`](/reference/javascript/auth/types/auth-error-payload)</code>
|
||||
|
||||
Provides details about the error
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isSuccess</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
Returns `true` if the action is successful.
|
||||
|
||||
---
|
||||
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: LinkIdTokenParams
|
||||
sidebarTitle: LinkIdTokenParams
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `LinkIdTokenParams`
|
||||
|
||||
```ts
|
||||
type LinkIdTokenParams = () => { idToken: string, provider: [Provider](/reference/javascript/auth/types/provider), nonce: string }
|
||||
```
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title: SignInIdTokenHandlerParams
|
||||
sidebarTitle: SignInIdTokenHandlerParams
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `SignInIdTokenHandlerParams`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">idToken</span>** <span className="optional-status">required</span> <code>string</code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">provider</span>** <span className="optional-status">required</span> [`Provider`](/reference/javascript/auth/types/provider)
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">nonce</span>** <span className="optional-status">optional</span> <code>string</code>
|
||||
|
||||
---
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
title: SignInIdTokenHandlerResult
|
||||
sidebarTitle: SignInIdTokenHandlerResult
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `SignInIdTokenHandlerResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
**`@returns`**
|
||||
|
||||
`true` if an error occurred
|
||||
|
||||
**`@depreacted`**
|
||||
|
||||
use `!isSuccess` or `!!error` instead
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> <code>null | [`AuthErrorPayload`](/reference/javascript/auth/types/auth-error-payload)</code>
|
||||
|
||||
Provides details about the error
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isSuccess</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
Returns `true` if the action is successful.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">user</span>** <span className="optional-status">required</span> <code>null | [`User`](/reference/javascript/auth/types/user)</code>
|
||||
|
||||
User information
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">accessToken</span>** <span className="optional-status">required</span> <code>null | string</code>
|
||||
|
||||
Access token (JWT)
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">refreshToken</span>** <span className="optional-status">required</span> <code>null | string</code>
|
||||
|
||||
Access token (JWT)
|
||||
|
||||
---
|
||||
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: SignInIdTokenParams
|
||||
sidebarTitle: SignInIdTokenParams
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `SignInIdTokenParams`
|
||||
|
||||
```ts
|
||||
type SignInIdTokenParams = () => { idToken: string, provider: [Provider](/reference/javascript/auth/types/provider), nonce: string }
|
||||
```
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
title: SignInIdTokenState
|
||||
sidebarTitle: SignInIdTokenState
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `SignInIdTokenState`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
**`@returns`**
|
||||
|
||||
`true` if an error occurred
|
||||
|
||||
**`@depreacted`**
|
||||
|
||||
use `!isSuccess` or `!!error` instead
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> <code>null | [`AuthErrorPayload`](/reference/javascript/auth/types/auth-error-payload)</code>
|
||||
|
||||
Provides details about the error
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isLoading</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
**`@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> <code>boolean</code>
|
||||
|
||||
Returns `true` if the action is successful.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">user</span>** <span className="optional-status">required</span> <code>null | [`User`](/reference/javascript/auth/types/user)</code>
|
||||
|
||||
User information
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">accessToken</span>** <span className="optional-status">required</span> <code>null | string</code>
|
||||
|
||||
Access token (JWT)
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">refreshToken</span>** <span className="optional-status">required</span> <code>null | string</code>
|
||||
|
||||
Access token (JWT)
|
||||
|
||||
---
|
||||
26
docs/reference/javascript/auth/verify-email-otp.mdx
Normal file
26
docs/reference/javascript/auth/verify-email-otp.mdx
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: verifyEmailOTP()
|
||||
sidebarTitle: verifyEmailOTP()
|
||||
---
|
||||
|
||||
Use `nhost.auth.verifyEmailOTP` to verify an email one-time password (OTP) and complete the sign-in process
|
||||
|
||||
```ts
|
||||
nhost.auth.verifyEmailOTP('user@example.com', '123456')
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">email</span>** <span className="optional-status">required</span> <code>string</code>
|
||||
|
||||
The email address to verify the OTP for
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">otp</span>** <span className="optional-status">required</span> <code>string</code>
|
||||
|
||||
The one-time password sent to the email address
|
||||
|
||||
---
|
||||
28
docs/reference/javascript/nhost-js/link-id-token.mdx
Normal file
28
docs/reference/javascript/nhost-js/link-id-token.mdx
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: linkIdToken()
|
||||
sidebarTitle: linkIdToken()
|
||||
---
|
||||
|
||||
Use `nhost.auth.linkIdToken` to link a user account with the provider's account using an ID token
|
||||
|
||||
```ts
|
||||
nhost.auth.linkIdToken({
|
||||
provider: 'google', // The provider name, e.g., 'google', 'apple', etc.
|
||||
idToken: '...', // The ID token issued by the provider.
|
||||
nonce: '...' // Optional: The nonce used during token generation.
|
||||
})
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">params</span>** <span className="optional-status">required</span> [`LinkIdTokenParams`](/reference/javascript/nhost-js/types/link-id-token-params)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :------------------------------------------------------------------------------------------ | :---------------------------------------------------------- | :------: | :---- |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>idToken</span> | <code>string</code> | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>provider</span> | [`Provider`](/reference/javascript/nhost-js/types/provider) | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>nonce</span> | <code>string</code> | | |
|
||||
|
||||
---
|
||||
33
docs/reference/javascript/nhost-js/sign-in-email-otp.mdx
Normal file
33
docs/reference/javascript/nhost-js/sign-in-email-otp.mdx
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
title: signInEmailOTP()
|
||||
sidebarTitle: signInEmailOTP()
|
||||
---
|
||||
|
||||
Use `nhost.auth.signInEmailOTP` to sign in with an email one-time password (OTP).
|
||||
|
||||
```ts
|
||||
nhost.auth.signInEmailOTP('user@example.com')
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">email</span>** <span className="optional-status">required</span> <code>string</code>
|
||||
|
||||
The email address to send the OTP to
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">options</span>** <span className="optional-status">optional</span> [`EmailOTPOptions`](/reference/javascript/nhost-js/types/email-otp-options)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :----------------------------------------------------------------------------------------------- | :----------------------------------------- | :------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| <span className="parameter-name"><span className="light-grey">options.</span>redirectTo</span> | <code>string</code> | | Redirection path in the client application that will be used in the link in the verification email. For instance, if you want to redirect to `https://myapp.com/success`, the `redirectTo` value is `'/success'`. |
|
||||
| <span className="parameter-name"><span className="light-grey">options.</span>metadata</span> | <code>Record<string, unknown></code> | | Custom additional user information stored in the `metadata` column. Can be any JSON object. |
|
||||
| <span className="parameter-name"><span className="light-grey">options.</span>displayName</span> | <code>string</code> | | Display name of the user. If not provided, it will use the display name given by the social provider (Oauth) used on registration, or the email address otherwise. |
|
||||
| <span className="parameter-name"><span className="light-grey">options.</span>defaultRole</span> | <code>string</code> | | Default role of the user. Must be part of the default allowed roles defined in Hasura Auth. |
|
||||
| <span className="parameter-name"><span className="light-grey">options.</span>allowedRoles</span> | <code>Array<string></code> | | Allowed roles of the user. Must be a subset of the default allowed roles defined in Hasura Auth. |
|
||||
| <span className="parameter-name"><span className="light-grey">options.</span>locale</span> | <code>string</code> | | Locale of the user, in two digits |
|
||||
|
||||
---
|
||||
28
docs/reference/javascript/nhost-js/sign-in-id-token.mdx
Normal file
28
docs/reference/javascript/nhost-js/sign-in-id-token.mdx
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: signInIdToken()
|
||||
sidebarTitle: signInIdToken()
|
||||
---
|
||||
|
||||
Use `nhost.auth.signInIdToken` to sign in a user with the provider's account using an ID token
|
||||
|
||||
```ts
|
||||
nhost.auth.signInIdToken({
|
||||
provider: 'google', // The provider name, e.g., 'google', 'apple', etc.
|
||||
idToken: '...', // The ID token issued by the provider.
|
||||
nonce: '...' // Optional: The nonce used during token generation.
|
||||
})
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">params</span>** <span className="optional-status">required</span> [`SignInIdTokenParams`](/reference/javascript/nhost-js/types/sign-in-id-token-params)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :------------------------------------------------------------------------------------------ | :---------------------------------------------------------- | :------: | :---- |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>idToken</span> | <code>string</code> | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>provider</span> | [`Provider`](/reference/javascript/nhost-js/types/provider) | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>nonce</span> | <code>string</code> | | |
|
||||
|
||||
---
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title: LinkIdTokenHandlerParams
|
||||
sidebarTitle: LinkIdTokenHandlerParams
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `LinkIdTokenHandlerParams`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">idToken</span>** <span className="optional-status">required</span> <code>string</code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">provider</span>** <span className="optional-status">required</span> [`Provider`](/reference/javascript/nhost-js/types/provider)
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">nonce</span>** <span className="optional-status">optional</span> <code>string</code>
|
||||
|
||||
---
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
title: LinkIdTokenHandlerResult
|
||||
sidebarTitle: LinkIdTokenHandlerResult
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `LinkIdTokenHandlerResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
**`@returns`**
|
||||
|
||||
`true` if an error occurred
|
||||
|
||||
**`@depreacted`**
|
||||
|
||||
use `!isSuccess` or `!!error` instead
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> <code>null | [`AuthErrorPayload`](/reference/javascript/nhost-js/types/auth-error-payload)</code>
|
||||
|
||||
Provides details about the error
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isSuccess</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
Returns `true` if the action is successful.
|
||||
|
||||
---
|
||||
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: LinkIdTokenParams
|
||||
sidebarTitle: LinkIdTokenParams
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `LinkIdTokenParams`
|
||||
|
||||
```ts
|
||||
type LinkIdTokenParams = () => { idToken: string, provider: [Provider](/reference/javascript/nhost-js/types/provider), nonce: string }
|
||||
```
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title: SignInIdTokenHandlerParams
|
||||
sidebarTitle: SignInIdTokenHandlerParams
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `SignInIdTokenHandlerParams`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">idToken</span>** <span className="optional-status">required</span> <code>string</code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">provider</span>** <span className="optional-status">required</span> [`Provider`](/reference/javascript/nhost-js/types/provider)
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">nonce</span>** <span className="optional-status">optional</span> <code>string</code>
|
||||
|
||||
---
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
title: SignInIdTokenHandlerResult
|
||||
sidebarTitle: SignInIdTokenHandlerResult
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `SignInIdTokenHandlerResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
**`@returns`**
|
||||
|
||||
`true` if an error occurred
|
||||
|
||||
**`@depreacted`**
|
||||
|
||||
use `!isSuccess` or `!!error` instead
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> <code>null | [`AuthErrorPayload`](/reference/javascript/nhost-js/types/auth-error-payload)</code>
|
||||
|
||||
Provides details about the error
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isSuccess</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
Returns `true` if the action is successful.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">user</span>** <span className="optional-status">required</span> <code>null | [`User`](/reference/javascript/nhost-js/types/user)</code>
|
||||
|
||||
User information
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">accessToken</span>** <span className="optional-status">required</span> <code>null | string</code>
|
||||
|
||||
Access token (JWT)
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">refreshToken</span>** <span className="optional-status">required</span> <code>null | string</code>
|
||||
|
||||
Access token (JWT)
|
||||
|
||||
---
|
||||
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: SignInIdTokenParams
|
||||
sidebarTitle: SignInIdTokenParams
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `SignInIdTokenParams`
|
||||
|
||||
```ts
|
||||
type SignInIdTokenParams = () => { idToken: string, provider: [Provider](/reference/javascript/nhost-js/types/provider), nonce: string }
|
||||
```
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
title: SignInIdTokenState
|
||||
sidebarTitle: SignInIdTokenState
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `SignInIdTokenState`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
**`@returns`**
|
||||
|
||||
`true` if an error occurred
|
||||
|
||||
**`@depreacted`**
|
||||
|
||||
use `!isSuccess` or `!!error` instead
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> <code>null | [`AuthErrorPayload`](/reference/javascript/nhost-js/types/auth-error-payload)</code>
|
||||
|
||||
Provides details about the error
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isLoading</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
**`@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> <code>boolean</code>
|
||||
|
||||
Returns `true` if the action is successful.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">user</span>** <span className="optional-status">required</span> <code>null | [`User`](/reference/javascript/nhost-js/types/user)</code>
|
||||
|
||||
User information
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">accessToken</span>** <span className="optional-status">required</span> <code>null | string</code>
|
||||
|
||||
Access token (JWT)
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">refreshToken</span>** <span className="optional-status">required</span> <code>null | string</code>
|
||||
|
||||
Access token (JWT)
|
||||
|
||||
---
|
||||
39
docs/reference/nextjs/types/link-id-token-hook-result.mdx
Normal file
39
docs/reference/nextjs/types/link-id-token-hook-result.mdx
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
title: LinkIdTokenHookResult
|
||||
sidebarTitle: LinkIdTokenHookResult
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `LinkIdTokenHookResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
**`@returns`**
|
||||
|
||||
`true` if an error occurred
|
||||
|
||||
**`@depreacted`**
|
||||
|
||||
use `!isSuccess` or `!!error` instead
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> <code>null | [`ErrorPayload`](/reference/nextjs/types/error-payload)</code>
|
||||
|
||||
Provides details about the error
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isSuccess</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
Returns `true` if the action is successful.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">linkIdToken</span>** <span className="optional-status">required</span> <code>LinkIdTokenHandler</code>
|
||||
|
||||
---
|
||||
65
docs/reference/nextjs/types/sign-in-id-token-hook-result.mdx
Normal file
65
docs/reference/nextjs/types/sign-in-id-token-hook-result.mdx
Normal file
@@ -0,0 +1,65 @@
|
||||
---
|
||||
title: SignInIdTokenHookResult
|
||||
sidebarTitle: SignInIdTokenHookResult
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `SignInIdTokenHookResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
**`@returns`**
|
||||
|
||||
`true` if an error occurred
|
||||
|
||||
**`@depreacted`**
|
||||
|
||||
use `!isSuccess` or `!!error` instead
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> <code>null | AuthErrorPayload</code>
|
||||
|
||||
Provides details about the error
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isLoading</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
**`@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> <code>boolean</code>
|
||||
|
||||
Returns `true` if the action is successful.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">user</span>** <span className="optional-status">required</span> <code>null | [`User`](/reference/nextjs/types/user)</code>
|
||||
|
||||
User information
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">accessToken</span>** <span className="optional-status">required</span> <code>null | string</code>
|
||||
|
||||
Access token (JWT)
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">refreshToken</span>** <span className="optional-status">required</span> <code>null | string</code>
|
||||
|
||||
Access token (JWT)
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">signInIdToken</span>** <span className="optional-status">required</span> <code>SignInIdTokenHandler</code>
|
||||
|
||||
---
|
||||
20
docs/reference/nextjs/use-link-id-token.mdx
Normal file
20
docs/reference/nextjs/use-link-id-token.mdx
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
title: useLinkIdToken()
|
||||
sidebarTitle: useLinkIdToken()
|
||||
---
|
||||
|
||||
Use the hook `useLinkIdToken` to link a user account with the provider's account using an id token
|
||||
|
||||
```tsx
|
||||
const { linkIdToken, isLoading, isSuccess, isError, error } = useLinkIdToken()
|
||||
|
||||
const handleFormSubmit = async (e) => {
|
||||
e.preventDefault()
|
||||
|
||||
await linkIdToken({
|
||||
provider: 'google',
|
||||
idToken: '...',
|
||||
nonce: '...'
|
||||
})
|
||||
}
|
||||
```
|
||||
@@ -23,6 +23,12 @@ const providerLink = useProviderLink()
|
||||
const providerLink = useProviderLink()
|
||||
```
|
||||
|
||||
Pass in the `connect` option to connect the user's account to the OAuth provider when different emails are used.
|
||||
|
||||
```js
|
||||
const providerLink = useProviderLink({ connect: true })
|
||||
```
|
||||
|
||||
```jsx
|
||||
import { useProviderLink } from '@nhost/react'
|
||||
|
||||
|
||||
38
docs/reference/nextjs/use-sign-in-email-otp.mdx
Normal file
38
docs/reference/nextjs/use-sign-in-email-otp.mdx
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
title: useSignInEmailOTP()
|
||||
sidebarTitle: useSignInEmailOTP()
|
||||
---
|
||||
|
||||
Use the hook `useSignInEmailOTP` to sign in a user with a one-time password sent via email.
|
||||
|
||||
## Usage
|
||||
|
||||
1. Call the `signInEmailOTP` function with the user's email to send a one-time password (OTP) to that email address.
|
||||
2. The state `needsOtp` will be `true`, indicating that an OTP is required.
|
||||
3. Once the user receives the OTP via email, call the `verifyEmailOTP` function with the email and the received OTP.
|
||||
4. On successful verification, the user is authenticated, and `isSuccess` becomes `true`.
|
||||
|
||||
Any error is monitored through `isError` and `error`. While the `signInEmailOTP` and `verifyEmailOTP` actions are running, `isLoading` equals `true`.
|
||||
|
||||
```tsx
|
||||
const { signInEmailOTP, verifyEmailOTP, isLoading, isSuccess, isError, error } =
|
||||
useSignInEmailOTP()
|
||||
|
||||
const signIn = async (e) => {
|
||||
e.preventDefault()
|
||||
await signInEmailOTP('john@gmail.com')
|
||||
}
|
||||
|
||||
const verify = async (e) => {
|
||||
e.preventDefault()
|
||||
await verifyEmailOTP('123456')
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">options</span>** <span className="optional-status">optional</span> <code>EmailOTPOptions</code>
|
||||
|
||||
---
|
||||
19
docs/reference/nextjs/use-sign-in-id-token.mdx
Normal file
19
docs/reference/nextjs/use-sign-in-id-token.mdx
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
title: useSignInIdToken()
|
||||
sidebarTitle: useSignInIdToken()
|
||||
---
|
||||
|
||||
Use the hook `useSignInIdToken` to sign in a user using an `idToken`.
|
||||
|
||||
```tsx
|
||||
const { signInIdToken, isLoading, isSuccess, isError, error } =
|
||||
useSignInIdToken()
|
||||
|
||||
console.log({ isLoading, isSuccess, isError, error })
|
||||
|
||||
const handleFormSubmit = async (e) => {
|
||||
e.preventDefault()
|
||||
|
||||
await signInIdToken({ provider: 'google', idToken: '...' })
|
||||
}
|
||||
```
|
||||
2039
docs/reference/openapi-auth-old.yaml
Normal file
2039
docs/reference/openapi-auth-old.yaml
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
39
docs/reference/react/types/link-id-token-hook-result.mdx
Normal file
39
docs/reference/react/types/link-id-token-hook-result.mdx
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
title: LinkIdTokenHookResult
|
||||
sidebarTitle: LinkIdTokenHookResult
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `LinkIdTokenHookResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
**`@returns`**
|
||||
|
||||
`true` if an error occurred
|
||||
|
||||
**`@depreacted`**
|
||||
|
||||
use `!isSuccess` or `!!error` instead
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> <code>null | [`ErrorPayload`](/reference/react/types/error-payload)</code>
|
||||
|
||||
Provides details about the error
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isSuccess</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
Returns `true` if the action is successful.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">linkIdToken</span>** <span className="optional-status">required</span> <code>LinkIdTokenHandler</code>
|
||||
|
||||
---
|
||||
65
docs/reference/react/types/sign-in-id-token-hook-result.mdx
Normal file
65
docs/reference/react/types/sign-in-id-token-hook-result.mdx
Normal file
@@ -0,0 +1,65 @@
|
||||
---
|
||||
title: SignInIdTokenHookResult
|
||||
sidebarTitle: SignInIdTokenHookResult
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `SignInIdTokenHookResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
**`@returns`**
|
||||
|
||||
`true` if an error occurred
|
||||
|
||||
**`@depreacted`**
|
||||
|
||||
use `!isSuccess` or `!!error` instead
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> <code>null | AuthErrorPayload</code>
|
||||
|
||||
Provides details about the error
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isLoading</span>** <span className="optional-status">required</span> <code>boolean</code>
|
||||
|
||||
**`@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> <code>boolean</code>
|
||||
|
||||
Returns `true` if the action is successful.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">user</span>** <span className="optional-status">required</span> <code>null | [`User`](/reference/react/types/user)</code>
|
||||
|
||||
User information
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">accessToken</span>** <span className="optional-status">required</span> <code>null | string</code>
|
||||
|
||||
Access token (JWT)
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">refreshToken</span>** <span className="optional-status">required</span> <code>null | string</code>
|
||||
|
||||
Access token (JWT)
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">signInIdToken</span>** <span className="optional-status">required</span> <code>SignInIdTokenHandler</code>
|
||||
|
||||
---
|
||||
20
docs/reference/react/use-link-id-token.mdx
Normal file
20
docs/reference/react/use-link-id-token.mdx
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
title: useLinkIdToken()
|
||||
sidebarTitle: useLinkIdToken()
|
||||
---
|
||||
|
||||
Use the hook `useLinkIdToken` to link a user account with the provider's account using an id token
|
||||
|
||||
```tsx
|
||||
const { linkIdToken, isLoading, isSuccess, isError, error } = useLinkIdToken()
|
||||
|
||||
const handleFormSubmit = async (e) => {
|
||||
e.preventDefault()
|
||||
|
||||
await linkIdToken({
|
||||
provider: 'google',
|
||||
idToken: '...',
|
||||
nonce: '...'
|
||||
})
|
||||
}
|
||||
```
|
||||
38
docs/reference/react/use-sign-in-email-otp.mdx
Normal file
38
docs/reference/react/use-sign-in-email-otp.mdx
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
title: useSignInEmailOTP()
|
||||
sidebarTitle: useSignInEmailOTP()
|
||||
---
|
||||
|
||||
Use the hook `useSignInEmailOTP` to sign in a user with a one-time password sent via email.
|
||||
|
||||
## Usage
|
||||
|
||||
1. Call the `signInEmailOTP` function with the user's email to send a one-time password (OTP) to that email address.
|
||||
2. The state `needsOtp` will be `true`, indicating that an OTP is required.
|
||||
3. Once the user receives the OTP via email, call the `verifyEmailOTP` function with the email and the received OTP.
|
||||
4. On successful verification, the user is authenticated, and `isSuccess` becomes `true`.
|
||||
|
||||
Any error is monitored through `isError` and `error`. While the `signInEmailOTP` and `verifyEmailOTP` actions are running, `isLoading` equals `true`.
|
||||
|
||||
```tsx
|
||||
const { signInEmailOTP, verifyEmailOTP, isLoading, isSuccess, isError, error } =
|
||||
useSignInEmailOTP()
|
||||
|
||||
const signIn = async (e) => {
|
||||
e.preventDefault()
|
||||
await signInEmailOTP('john@gmail.com')
|
||||
}
|
||||
|
||||
const verify = async (e) => {
|
||||
e.preventDefault()
|
||||
await verifyEmailOTP('123456')
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">options</span>** <span className="optional-status">optional</span> <code>EmailOTPOptions</code>
|
||||
|
||||
---
|
||||
19
docs/reference/react/use-sign-in-id-token.mdx
Normal file
19
docs/reference/react/use-sign-in-id-token.mdx
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
title: useSignInIdToken()
|
||||
sidebarTitle: useSignInIdToken()
|
||||
---
|
||||
|
||||
Use the hook `useSignInIdToken` to sign in a user using an `idToken`.
|
||||
|
||||
```tsx
|
||||
const { signInIdToken, isLoading, isSuccess, isError, error } =
|
||||
useSignInIdToken()
|
||||
|
||||
console.log({ isLoading, isSuccess, isError, error })
|
||||
|
||||
const handleFormSubmit = async (e) => {
|
||||
e.preventDefault()
|
||||
|
||||
await signInIdToken({ provider: 'google', idToken: '...' })
|
||||
}
|
||||
```
|
||||
47
docs/reference/vue/types/link-id-token-result.mdx
Normal file
47
docs/reference/vue/types/link-id-token-result.mdx
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
title: LinkIdTokenResult
|
||||
sidebarTitle: LinkIdTokenResult
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `LinkIdTokenResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> <code>Ref<boolean></code>
|
||||
|
||||
**`@returns`**
|
||||
|
||||
`true` if an error occurred
|
||||
|
||||
**`@depreacted`**
|
||||
|
||||
use `!isSuccess` or `!!error` instead
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> <code>Ref<null | ErrorPayload<any>></code>
|
||||
|
||||
Provides details about the error
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isLoading</span>** <span className="optional-status">required</span> <code>Ref<boolean></code>
|
||||
|
||||
**`@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> <code>Ref<boolean></code>
|
||||
|
||||
Returns `true` if the action is successful.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">linkIdToken</span>** <span className="optional-status">required</span> <code>(params: LinkIdTokenHandlerParams) => Promise<LinkIdTokenHandlerResult></code>
|
||||
|
||||
---
|
||||
18
docs/reference/vue/use-link-id-token.mdx
Normal file
18
docs/reference/vue/use-link-id-token.mdx
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title: useLinkIdToken()
|
||||
sidebarTitle: useLinkIdToken()
|
||||
---
|
||||
|
||||
Use the hook `useLinkIdToken` to link a user account with the provider's account using an id token
|
||||
|
||||
```tsx
|
||||
const { linkIdToken, isLoading, isSuccess, isError, error } = useLinkIdToken()
|
||||
|
||||
const handleLinkIdToken = async () => {
|
||||
await linkIdToken({
|
||||
provider: 'google',
|
||||
idToken: '...',
|
||||
nonce: '...'
|
||||
})
|
||||
}
|
||||
```
|
||||
39
docs/reference/vue/use-sign-in-email-otp.mdx
Normal file
39
docs/reference/vue/use-sign-in-email-otp.mdx
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
title: useSignInEmailOTP()
|
||||
sidebarTitle: useSignInEmailOTP()
|
||||
---
|
||||
|
||||
Use the `useSignInEmailOTP` composable to sign in a user with a one-time password sent via email.
|
||||
|
||||
## Usage
|
||||
|
||||
1. Call the `signInEmailOTP` function with the user's email to send a one-time password (OTP) to that email address.
|
||||
2. The state `needsOtp` will be `true`, indicating that an OTP is required.
|
||||
3. Once the user receives the OTP via email, call the `verifyEmailOTP` function with the email and the received OTP.
|
||||
4. On successful verification, the user is authenticated, and `isSuccess` becomes `true`.
|
||||
|
||||
Any errors during the sign-in or verification process are tracked using `isError` and `error`. While the `signInEmailOTP` and `verifyEmailOTP` actions are in progress, `isLoading` is `true`.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const { signInEmailOTP, verifyEmailOTP, error } = useSignInEmailOTP()
|
||||
|
||||
const requestOtp = async (e: Event) => {
|
||||
e.preventDefault()
|
||||
await signInEmailOTP(email.value)
|
||||
}
|
||||
|
||||
const confirmOtp = async (e: Event) => {
|
||||
e.preventDefault()
|
||||
await verifyEmailOTP(email.value, otp.value)
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">options</span>** <span className="optional-status">optional</span> <code>NestedRefOfValue<undefined | EmailOTPOptions></code>
|
||||
|
||||
---
|
||||
17
docs/reference/vue/use-sign-in-id-token.mdx
Normal file
17
docs/reference/vue/use-sign-in-id-token.mdx
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
title: useSignInIdToken()
|
||||
sidebarTitle: useSignInIdToken()
|
||||
---
|
||||
|
||||
Use the composable `useSignInIdToken` to sign in a user using an `idToken`.
|
||||
|
||||
```ts
|
||||
const { signInIdToken, isLoading, isSuccess, isError, error } =
|
||||
useSignInIdToken()
|
||||
|
||||
console.log({ isLoading, isSuccess, isError, error })
|
||||
|
||||
const handleSignInIdToken = async () => {
|
||||
await signInIdToken({ provider: 'google', idToken: '...' })
|
||||
}
|
||||
```
|
||||
@@ -1,5 +1,18 @@
|
||||
# @nhost-examples/cli
|
||||
|
||||
## 0.3.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@3.2.1
|
||||
|
||||
## 0.3.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [72899a6]
|
||||
- @nhost/nhost-js@3.2.0
|
||||
|
||||
## 0.3.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost-examples/cli",
|
||||
"version": "0.3.12",
|
||||
"version": "0.3.14",
|
||||
"main": "src/index.mjs",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
# @nhost-examples/codegen-react-apollo
|
||||
|
||||
## 0.4.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [14e6100]
|
||||
- @nhost/react@3.8.0
|
||||
- @nhost/react-apollo@15.0.0
|
||||
|
||||
## 0.4.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fe6e8e2]
|
||||
- @nhost/react@3.7.0
|
||||
- @nhost/react-apollo@14.0.0
|
||||
|
||||
## 0.4.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost-examples/codegen-react-apollo",
|
||||
"version": "0.4.13",
|
||||
"version": "0.4.15",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"codegen": "graphql-codegen",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user