Compare commits
154 Commits
@nhost/rea
...
@nhost/rea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
024f026241 | ||
|
|
a422a4850d | ||
|
|
a7e67979fe | ||
|
|
1dcbf268db | ||
|
|
5c5d489740 | ||
|
|
a2559e3482 | ||
|
|
bbef104a85 | ||
|
|
7843b1aec1 | ||
|
|
4711bfa8ec | ||
|
|
6f3f8a5020 | ||
|
|
a120bcc8fc | ||
|
|
53e20e87f3 | ||
|
|
9479aeb596 | ||
|
|
c4f11af072 | ||
|
|
747aa96914 | ||
|
|
5682d92592 | ||
|
|
2cf6556499 | ||
|
|
89553fcaf6 | ||
|
|
10beea7246 | ||
|
|
1334ddb693 | ||
|
|
d212128815 | ||
|
|
302c28b202 | ||
|
|
f3f760b987 | ||
|
|
9d9caf9834 | ||
|
|
96cbf023ca | ||
|
|
1ed534cb4a | ||
|
|
dcdee0b426 | ||
|
|
e31f4756b4 | ||
|
|
259e198d80 | ||
|
|
1d10a47414 | ||
|
|
34470ff6e0 | ||
|
|
f30d6779bb | ||
|
|
2a3b2c3af5 | ||
|
|
a0db6b58de | ||
|
|
523d52aa7f | ||
|
|
6e1ee1802d | ||
|
|
51ad1eb355 | ||
|
|
ee2dd8481b | ||
|
|
b8e787cb47 | ||
|
|
2ef5c238c1 | ||
|
|
e084643032 | ||
|
|
5514e81186 | ||
|
|
16f38aa893 | ||
|
|
76c6e8d0d6 | ||
|
|
197d1d5cfc | ||
|
|
abd43d0a8b | ||
|
|
70383c8c80 | ||
|
|
a7d5c85f60 | ||
|
|
bc657251d6 | ||
|
|
5abc362a4d | ||
|
|
7a4c9fa806 | ||
|
|
348318d709 | ||
|
|
4e4600d769 | ||
|
|
44d57d4b89 | ||
|
|
84ba29dd7f | ||
|
|
b5f7f7fe5f | ||
|
|
7116a4df8a | ||
|
|
7e4c52dbd1 | ||
|
|
446dc01bde | ||
|
|
a1989c51f8 | ||
|
|
1383de558a | ||
|
|
d828107f74 | ||
|
|
4a1650cb35 | ||
|
|
913651d440 | ||
|
|
6af2d52666 | ||
|
|
da7c2a2362 | ||
|
|
4a7940b59a | ||
|
|
ddda8bb031 | ||
|
|
b146e60f7e | ||
|
|
5591789840 | ||
|
|
fac5ddb866 | ||
|
|
f2fab8dac2 | ||
|
|
6e3f2c382d | ||
|
|
05385d01dc | ||
|
|
7ea72b799c | ||
|
|
4936261cee | ||
|
|
80902b9cf1 | ||
|
|
c3af490e67 | ||
|
|
6a24e32857 | ||
|
|
0ebddd30cf | ||
|
|
d019f1de21 | ||
|
|
3abb57f510 | ||
|
|
4a2ad15f14 | ||
|
|
ca45b612c9 | ||
|
|
27ee9b721f | ||
|
|
2a373dd50f | ||
|
|
a91f714c4c | ||
|
|
3b4d89d5b6 | ||
|
|
16d1b26298 | ||
|
|
86d8beb044 | ||
|
|
17f870f31f | ||
|
|
fbfffe25ca | ||
|
|
87a472b27e | ||
|
|
779b03b0b2 | ||
|
|
9d933b6ffd | ||
|
|
34d643868d | ||
|
|
0023f5f6f6 | ||
|
|
48f5c8bfb9 | ||
|
|
f398b2e3ac | ||
|
|
11795abe61 | ||
|
|
e2eafc9ee1 | ||
|
|
4a5a2fac43 | ||
|
|
4a908af7ef | ||
|
|
a7b6498053 | ||
|
|
7f418a7559 | ||
|
|
8493129750 | ||
|
|
26b817c5fa | ||
|
|
e61ea19421 | ||
|
|
401f2cb540 | ||
|
|
6363a289fb | ||
|
|
f09037ccef | ||
|
|
a4dea7339e | ||
|
|
50474810bf | ||
|
|
f356c7176b | ||
|
|
cb99c6d989 | ||
|
|
7cef49bb02 | ||
|
|
6eaa5c7920 | ||
|
|
64574ee892 | ||
|
|
d3d38b2631 | ||
|
|
023afae3cd | ||
|
|
19d2242918 | ||
|
|
ead2c16aac | ||
|
|
a5f02e8056 | ||
|
|
aeb85a1e01 | ||
|
|
821912e23e | ||
|
|
8608a78eaf | ||
|
|
2d2da4f6e0 | ||
|
|
19d7262b05 | ||
|
|
1c750bd652 | ||
|
|
8a3943a942 | ||
|
|
62385a7866 | ||
|
|
c101a26ce5 | ||
|
|
21fa83d115 | ||
|
|
522839d8f7 | ||
|
|
87aad599f3 | ||
|
|
5b097e635d | ||
|
|
bfdcacd5a3 | ||
|
|
dcb9055475 | ||
|
|
6f0bf3d67c | ||
|
|
3c96c561a0 | ||
|
|
3d319364f3 | ||
|
|
80468ac3ac | ||
|
|
d03653f1fd | ||
|
|
5dff7ad5d3 | ||
|
|
9263bea2ae | ||
|
|
4f994b536e | ||
|
|
c907021313 | ||
|
|
12a218b12c | ||
|
|
196156ff93 | ||
|
|
28ca032f70 | ||
|
|
333292ab89 | ||
|
|
db955e3b71 | ||
|
|
18ac56d097 | ||
|
|
366fc2403d |
@@ -1,4 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
|
||||||
|
|
||||||
npx lint-staged
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"packages/(docgen|hasura-auth-js|hasura-storage-js|nextjs|nhost-js|react|core|vue)/src/**/*.{js,ts,jsx,tsx}": [
|
|
||||||
"pnpm docgen",
|
|
||||||
"git add docs"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
54
README.md
@@ -147,13 +147,6 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<sub><b>Johan Eliasson</b></sub>
|
<sub><b>Johan Eliasson</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td align="center">
|
|
||||||
<a href="https://github.com/szilarddoro">
|
|
||||||
<img src="https://avatars.githubusercontent.com/u/310881?v=4" width="100;" alt="szilarddoro"/>
|
|
||||||
<br />
|
|
||||||
<sub><b>Szilárd Dóró</b></sub>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/gdangelo">
|
<a href="https://github.com/gdangelo">
|
||||||
<img src="https://avatars.githubusercontent.com/u/4352286?v=4" width="100;" alt="gdangelo"/>
|
<img src="https://avatars.githubusercontent.com/u/4352286?v=4" width="100;" alt="gdangelo"/>
|
||||||
@@ -174,15 +167,15 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<br />
|
<br />
|
||||||
<sub><b>Guido Curcio</b></sub>
|
<sub><b>Guido Curcio</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td></tr>
|
</td>
|
||||||
<tr>
|
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/subatuba21">
|
<a href="https://github.com/subatuba21">
|
||||||
<img src="https://avatars.githubusercontent.com/u/34824571?v=4" width="100;" alt="subatuba21"/>
|
<img src="https://avatars.githubusercontent.com/u/34824571?v=4" width="100;" alt="subatuba21"/>
|
||||||
<br />
|
<br />
|
||||||
<sub><b>Subha Das</b></sub>
|
<sub><b>Subha Das</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td></tr>
|
||||||
|
<tr>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/sebagudelo">
|
<a href="https://github.com/sebagudelo">
|
||||||
<img src="https://avatars.githubusercontent.com/u/43288271?v=4" width="100;" alt="sebagudelo"/>
|
<img src="https://avatars.githubusercontent.com/u/43288271?v=4" width="100;" alt="sebagudelo"/>
|
||||||
@@ -204,21 +197,35 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<sub><b>Pratim</b></sub>
|
<sub><b>Pratim</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<a href="https://github.com/szilarddoro">
|
||||||
|
<img src="https://avatars.githubusercontent.com/u/310881?v=4" width="100;" alt="szilarddoro"/>
|
||||||
|
<br />
|
||||||
|
<sub><b>Szilárd Dóró</b></sub>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<a href="https://github.com/GavanWilhite">
|
||||||
|
<img src="https://avatars.githubusercontent.com/u/2085119?v=4" width="100;" alt="GavanWilhite"/>
|
||||||
|
<br />
|
||||||
|
<sub><b>Gavan Wilhite</b></sub>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/FuzzyReason">
|
<a href="https://github.com/FuzzyReason">
|
||||||
<img src="https://avatars.githubusercontent.com/u/62517920?v=4" width="100;" alt="FuzzyReason"/>
|
<img src="https://avatars.githubusercontent.com/u/62517920?v=4" width="100;" alt="FuzzyReason"/>
|
||||||
<br />
|
<br />
|
||||||
<sub><b>Vadim Smirnov</b></sub>
|
<sub><b>Vadim Smirnov</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td></tr>
|
||||||
|
<tr>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/macmac49">
|
<a href="https://github.com/macmac49">
|
||||||
<img src="https://avatars.githubusercontent.com/u/831190?v=4" width="100;" alt="macmac49"/>
|
<img src="https://avatars.githubusercontent.com/u/831190?v=4" width="100;" alt="macmac49"/>
|
||||||
<br />
|
<br />
|
||||||
<sub><b>Macmac49</b></sub>
|
<sub><b>Macmac49</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td></tr>
|
</td>
|
||||||
<tr>
|
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/subhendukundu">
|
<a href="https://github.com/subhendukundu">
|
||||||
<img src="https://avatars.githubusercontent.com/u/20059141?v=4" width="100;" alt="subhendukundu"/>
|
<img src="https://avatars.githubusercontent.com/u/20059141?v=4" width="100;" alt="subhendukundu"/>
|
||||||
@@ -253,13 +260,6 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<br />
|
<br />
|
||||||
<sub><b>Filip Hájek</b></sub>
|
<sub><b>Filip Hájek</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
|
||||||
<td align="center">
|
|
||||||
<a href="https://github.com/GavanWilhite">
|
|
||||||
<img src="https://avatars.githubusercontent.com/u/2085119?v=4" width="100;" alt="GavanWilhite"/>
|
|
||||||
<br />
|
|
||||||
<sub><b>Gavan Wilhite</b></sub>
|
|
||||||
</a>
|
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
@@ -391,6 +391,13 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
</a>
|
</a>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
<td align="center">
|
||||||
|
<a href="https://github.com/nachoaldamav">
|
||||||
|
<img src="https://avatars.githubusercontent.com/u/22749943?v=4" width="100;" alt="nachoaldamav"/>
|
||||||
|
<br />
|
||||||
|
<sub><b>Nacho Aldama</b></sub>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/ghoshnirmalya">
|
<a href="https://github.com/ghoshnirmalya">
|
||||||
<img src="https://avatars.githubusercontent.com/u/6391763?v=4" width="100;" alt="ghoshnirmalya"/>
|
<img src="https://avatars.githubusercontent.com/u/6391763?v=4" width="100;" alt="ghoshnirmalya"/>
|
||||||
@@ -412,6 +419,13 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<sub><b>Tapas Adhikary</b></sub>
|
<sub><b>Tapas Adhikary</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<a href="https://github.com/uulwake">
|
||||||
|
<img src="https://avatars.githubusercontent.com/u/22399181?v=4" width="100;" alt="uulwake"/>
|
||||||
|
<br />
|
||||||
|
<sub><b>Ulrich Wake</b></sub>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/komninoschat">
|
<a href="https://github.com/komninoschat">
|
||||||
<img src="https://avatars.githubusercontent.com/u/29049104?v=4" width="100;" alt="komninoschat"/>
|
<img src="https://avatars.githubusercontent.com/u/29049104?v=4" width="100;" alt="komninoschat"/>
|
||||||
|
|||||||
4
config/.husky/pre-commit
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
. "$(dirname "$0")/_/husky.sh"
|
||||||
|
|
||||||
|
npx lint-staged --config config/.lintstagedrc.js
|
||||||
8
config/.lintstagedrc.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
module.exports = {
|
||||||
|
'packages/(docgen|hasura-auth-js|hasura-storage-js|nextjs|nhost-js|react|core|vue)/src/**/*.{js,ts,jsx,tsx}':
|
||||||
|
['pnpm docgen', 'git add docs'],
|
||||||
|
'(nhost-cloud.yaml|**/nhost/config.yaml)': () => [
|
||||||
|
'pnpm sync-versions',
|
||||||
|
"git add ':(glob)**/nhost/config.yaml'"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
# @nhost/docs
|
# @nhost/docs
|
||||||
|
|
||||||
|
## 0.0.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 747aa969: fix: added twitch and discord as provider
|
||||||
|
|
||||||
## 0.0.1
|
## 0.0.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
---
|
||||||
|
title: Sign In with Apple
|
||||||
|
sidebar_label: Apple
|
||||||
|
slug: /platform/authentication/sign-in-with-apple
|
||||||
|
image: /img/og/platform/sign-in-with-apple.png
|
||||||
|
---
|
||||||
|
|
||||||
|
Follow this guide to sign in users with Apple with your Nhost App.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img
|
||||||
|
alt="Apple Sign In Preview"
|
||||||
|
src="/img/social-providers/apple-preview.svg"
|
||||||
|
width={480}
|
||||||
|
height={267}
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Create Apple Developer Account
|
||||||
|
|
||||||
|
- Click on "Account" in the top menu.
|
||||||
|
- Create a new [Apple Developer account](https://developer.apple.com) if you don't have one already and sign in to the Apple Developer platform.
|
||||||
|
|
||||||
|
## Get an App ID
|
||||||
|
|
||||||
|
- Go to the [Apple Developer Dashboard](https://developer.apple.com/account/).
|
||||||
|
- Click on **Certificates, IDs & Profiles** in the left menu.
|
||||||
|
- Click on **Identifiers** in the left menu.
|
||||||
|
- Click on the "+" button in the header next to "Identifiers".
|
||||||
|
- Select **App IDs** and click **Continue**.
|
||||||
|
- Select type **App** and click **Continue**.
|
||||||
|
- Fill in the App information:
|
||||||
|
|
||||||
|
- Description.
|
||||||
|
- Bundle ID (ex. io.nhost.app or com.your-startup.app).
|
||||||
|
- Scroll down and check **Sign In With Apple**.
|
||||||
|
- Click **Continue** in the top right corner.
|
||||||
|
- Click **Register** in the top right corner.
|
||||||
|
|
||||||
|
- Click on the newly created app to see **Team ID**.
|
||||||
|
|
||||||
|
- **Team ID**: Copy and paste the **Team ID** to your Nhost OAuth settings for Apple.
|
||||||
|
|
||||||
|
## Get a Service ID
|
||||||
|
|
||||||
|
- Go to the [Apple Developer Dashboard](https://developer.apple.com/account/).
|
||||||
|
- Click on **Certificates, IDs & Profiles** in the left menu.
|
||||||
|
- Click on **Identifiers** in the left menu.
|
||||||
|
- Click on **Certificates, IDs & Profiles** in the left menu.
|
||||||
|
- Click on **Identifiers** in the left menu.
|
||||||
|
- Click on the "+" button in the header next to "Identifiers".
|
||||||
|
- Select **Service IDs** and click **Continue**.
|
||||||
|
|
||||||
|
- Fill in the Service information:
|
||||||
|
|
||||||
|
- Description.
|
||||||
|
- Identifier (Service ID) (ex. _service_.io.nhost.app or _service_.com.your-startup.app). Notice you can't use the same identifier as for the app so we recommend adding "service" at the beginning if the identifier.
|
||||||
|
- **Service ID**: Copy and paste the **Identifier (Service ID)** to your Nhost OAuth settings for Apple.
|
||||||
|
- Click **Continue** in the top right corner.
|
||||||
|
- Click **Register** in the top right corner.
|
||||||
|
|
||||||
|
- Click on the newly created service in the list of Identifiers.
|
||||||
|
- Click the checkbox to enable "Sign in with Apple".
|
||||||
|
- Click **Configure** next to "Sign in with Apple".
|
||||||
|
- Make sure your newly created Bundle ID is selected under Primary App ID.
|
||||||
|
- Add your base auth domain under "Domains and Subdomains". E.g. `<subdomain>.nhost.run`.
|
||||||
|
- Add the full callback URL under "Return URLs". E.g. `https://<subdomain>.nhost.run/v1/auth/signin/provider/apple/callback`.
|
||||||
|
- Click **Next**.
|
||||||
|
- Click **Done**.
|
||||||
|
- Click **Continue** in the top right corner.
|
||||||
|
- Click **Save** in the top right corner.
|
||||||
|
|
||||||
|
## Generate Key
|
||||||
|
|
||||||
|
- Go to the [Apple Developer Dashboard](https://developer.apple.com/account/).
|
||||||
|
- Click on **Certificates, IDs & Profiles** in the left menu.
|
||||||
|
- Click on **Keys** in the left menu.
|
||||||
|
- Click on **Create a key**.
|
||||||
|
- Fill in a name for your key.
|
||||||
|
- Click the checkbox to enable "Sign in with Apple".
|
||||||
|
- Click **Configure** next to "Sign in with Apple".
|
||||||
|
- Select your newly created App ID in the dropdown selector.
|
||||||
|
- Click **Save** in the top right corner.
|
||||||
|
- Click **Continue** in the top right corner.
|
||||||
|
- Click **Register** in the top right corner.
|
||||||
|
- **Key ID**: Copy and paste the **Key ID** to your Nhost OAuth settings for Apple.
|
||||||
|
- Click **Download** to download the key to your computer.
|
||||||
|
- **Private Key**: Copy and paste the content of the downloaded key to your Nhost OAuth settings for Apple.
|
||||||
|
|
||||||
|
## Sign In Users
|
||||||
|
|
||||||
|
Use the [Nhost JavaScript client](/reference/javascript) to sign in users in your app:
|
||||||
|
|
||||||
|
```js
|
||||||
|
nhost.auth.signIn({
|
||||||
|
provider: 'apple'
|
||||||
|
})
|
||||||
|
```
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
---
|
||||||
|
title: Sign In with Discord
|
||||||
|
sidebar_label: Discord
|
||||||
|
slug: /platform/authentication/sign-in-with-discord
|
||||||
|
image: /img/og/platform/sign-in-with-discord.png
|
||||||
|
---
|
||||||
|
|
||||||
|
Follow this guide to sign in users with Discord with your Nhost App.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img
|
||||||
|
alt="Discord Sign In Preview"
|
||||||
|
src="/img/social-providers/discord-preview.svg"
|
||||||
|
width={480}
|
||||||
|
height={267}
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Create Discord Account
|
||||||
|
|
||||||
|
- Create a new [Discord account](https://discord.com/) if you don't have one already.
|
||||||
|
|
||||||
|
## Create Discord App
|
||||||
|
|
||||||
|
- Sign in to the [Discord Developer Portal](https://discord.com/developers/applications).
|
||||||
|
- Click on **New Application** in the top right corner.
|
||||||
|
- Fill in the name of your Discord Application and click **Create**.
|
||||||
|
- Click on **OAuth2** settings in the left menu.
|
||||||
|
- Copy the **Client ID** and paste it into your Nhost OAuth settings for Discord.
|
||||||
|
- Click on **Reset Secret**.
|
||||||
|
- Click **Yes, do it** to generate a new secret.
|
||||||
|
- Copy the **Client Secret** and paste it into your Nhost OAuth settings for Discord.
|
||||||
|
- Click on **Add Redirect**.
|
||||||
|
- Copy and paste the callback URL from your Nhost OAuth settings for Discord to the input field in the Discord Developer portal.
|
||||||
|
- Click **Save Changes** to save the added callback URL.
|
||||||
|
|
||||||
|
## Sign In Users
|
||||||
|
|
||||||
|
Use the [Nhost JavaScript client](/reference/javascript) to sign in users in your app:
|
||||||
|
|
||||||
|
```js
|
||||||
|
nhost.auth.signIn({
|
||||||
|
provider: 'discord'
|
||||||
|
})
|
||||||
|
```
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
---
|
||||||
|
title: Sign In with Twitch
|
||||||
|
sidebar_label: Twitch
|
||||||
|
slug: /platform/authentication/sign-in-with-twitch
|
||||||
|
image: /img/og/platform/sign-in-with-twitch.png
|
||||||
|
---
|
||||||
|
|
||||||
|
Follow this guide to sign in users with Twitch with your Nhost App.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img
|
||||||
|
alt="Twitch Sign In Preview"
|
||||||
|
src="/img/social-providers/twitch-preview.svg"
|
||||||
|
width={480}
|
||||||
|
height={267}
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Create Twitch Account
|
||||||
|
|
||||||
|
- Create a new [Twitch account](https://twitch.tv/) if you don't have one already.
|
||||||
|
|
||||||
|
## Create Twitch App
|
||||||
|
|
||||||
|
- Sign in to the [Twitch Developer Console](https://dev.twitch.tv/console).
|
||||||
|
- Click on **Register Your Application**.
|
||||||
|
- Fill in a **Twitch application name**.
|
||||||
|
- Copy and paste the callback URL from your Nhost OAuth settings for Twitch to the input field under **OAuth Redirect URLs** and click **Add** to the right of the input field.
|
||||||
|
- Select an application **Category**. E.g. _Application Integration_.
|
||||||
|
- Click **Create**.
|
||||||
|
|
||||||
|
## Get Twitch Appplication Client ID and Client Secret
|
||||||
|
|
||||||
|
- Click on **Manage** on your newly created Twitch application.
|
||||||
|
- Copy the **Client ID** and paste it into your Nhost OAuth settings for Twitch.
|
||||||
|
- Click on **New Secret** to generate a new client secret.
|
||||||
|
- Copy the **Client Secret** and paste it into your Nhost OAuth settings for Twitch.
|
||||||
|
|
||||||
|
## Sign In Users
|
||||||
|
|
||||||
|
Use the [Nhost JavaScript client](/reference/javascript) to sign in users in your app:
|
||||||
|
|
||||||
|
```js
|
||||||
|
nhost.auth.signIn({
|
||||||
|
provider: 'twitch'
|
||||||
|
})
|
||||||
|
```
|
||||||
@@ -35,6 +35,18 @@ nhost.auth.signIn({
|
|||||||
|
|
||||||
Users are redirected to your Nhost app's **client URL** by default. By default, your Nhost app's client URL is set to `http://localhost:3000`. You can change the value of your client URL in the Nhost console by going to **Users** → **Authentication Settings** → **Client URL**.
|
Users are redirected to your Nhost app's **client URL** by default. By default, your Nhost app's client URL is set to `http://localhost:3000`. You can change the value of your client URL in the Nhost console by going to **Users** → **Authentication Settings** → **Client URL**.
|
||||||
|
|
||||||
|
|
||||||
|
Here is an example of how to redirect to another host or path:
|
||||||
|
|
||||||
|
```js
|
||||||
|
nhost.auth.signIn({
|
||||||
|
provider: '<provider>'
|
||||||
|
options: {
|
||||||
|
redirectTo: "<host>/<slug>" // Example: "https://example.com/dashboard"
|
||||||
|
},
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
## Provider OAuth scopes
|
## Provider OAuth scopes
|
||||||
|
|
||||||
Scopes are a mechanism in OAuth to allow or limit an application's access to a user's account.
|
Scopes are a mechanism in OAuth to allow or limit an application's access to a user's account.
|
||||||
|
|||||||
@@ -81,6 +81,18 @@ nhost up
|
|||||||
|
|
||||||
Hasura Console starts automatically and your Nhost app is running locally with the backend URL: `http://localhost:1337`.
|
Hasura Console starts automatically and your Nhost app is running locally with the backend URL: `http://localhost:1337`.
|
||||||
|
|
||||||
|
## Subdomain and Region
|
||||||
|
|
||||||
|
Use `localhost:1337` as the `subdomain`, and skip `region` when using the CLI and the [JavaScript SDK](/reference/javascript):
|
||||||
|
|
||||||
|
```
|
||||||
|
import { NhostClient } from '@nhost/nhost-js'
|
||||||
|
|
||||||
|
const nhost = new NhostClient({
|
||||||
|
subdomain: 'localhost:1337',
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
## Emails
|
## Emails
|
||||||
|
|
||||||
During local development with the CLI, all transactional emails from Authentication are sent to a local Mailhog instance, instead of to the recipient's email address. You'll see an address where after starting [`nhost up`](/reference/cli/up) where all emails are sent to.
|
During local development with the CLI, all transactional emails from Authentication are sent to a local Mailhog instance, instead of to the recipient's email address. You'll see an address where after starting [`nhost up`](/reference/cli/up) where all emails are sent to.
|
||||||
|
|||||||
@@ -132,7 +132,8 @@ import { NhostNextProvider, NhostClient } from '@nhost/nextjs';
|
|||||||
|
|
||||||
// highlight-start
|
// highlight-start
|
||||||
const nhost = new NhostClient({
|
const nhost = new NhostClient({
|
||||||
backendUrl: process.env.NEXT_PUBLIC_NHOST_BACKEND_URL || '',
|
subdomain: process.env.NEXT_PUBLIC_NHOST_SUBDOMAIN || '',
|
||||||
|
region: process.env.NEXT_PUBLIC_NHOST_REGION || ''
|
||||||
});
|
});
|
||||||
// highlight-end
|
// highlight-end
|
||||||
|
|
||||||
@@ -149,16 +150,16 @@ function MyApp({ Component, pageProps }) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, make sure to create an environment variable named
|
Finally, store the environment variables for `subdomain` and `region` in `.env.development`:
|
||||||
`NEXT_PUBLIC_NHOST_BACKEND_URL` to store your Nhost backend URL:
|
|
||||||
|
|
||||||
```yaml title=".env.development"
|
```yaml title=".env.development"
|
||||||
NEXT_PUBLIC_NHOST_BACKEND_URL=YOUR_NHOST_BACKEND_URL
|
NEXT_PUBLIC_NHOST_SUBDOMAIN=YOUR_NHOST_APP_SUBDOMAIN
|
||||||
|
NEXT_PUBLIC_NHOST_REGION=YOUR_NHOST_APP_REGION
|
||||||
```
|
```
|
||||||
|
|
||||||
You can find your Nhost backend URL for your project from [your dashboard](https://app.nhost.io) as shown below:
|
You find your Nhost app's subdomain and region in [the app dashboard](https://app.nhost.io):
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
:::caution
|
:::caution
|
||||||
Don't forget to restart your Next.js server after saving your `.env.development`
|
Don't forget to restart your Next.js server after saving your `.env.development`
|
||||||
|
|||||||
@@ -128,7 +128,8 @@ Nhost backend:
|
|||||||
import { NhostClient, NhostReactProvider } from '@nhost/react'
|
import { NhostClient, NhostReactProvider } from '@nhost/react'
|
||||||
|
|
||||||
const nhost = new NhostClient({
|
const nhost = new NhostClient({
|
||||||
backendUrl: process.env.REACT_APP_NHOST_BACKEND_URL || ''
|
subdomain: process.env.REACT_APP_NHOST_SUBDOMAIN,
|
||||||
|
region: process.env.REACT_APP_NHOST_REGION
|
||||||
})
|
})
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
@@ -143,15 +144,16 @@ export default App
|
|||||||
```
|
```
|
||||||
|
|
||||||
Finally, make sure to create an environment variable named
|
Finally, make sure to create an environment variable named
|
||||||
`REACT_APP_NHOST_BACKEND_URL` to store your Nhost backend URL:
|
`REACT_APP_NHOST_SUBDOMAIN` and `REACT_APP_NHOST_REGION` to store your Nhost domain details:
|
||||||
|
|
||||||
```yaml title=".env.local"
|
```yaml title=".env.local"
|
||||||
REACT_APP_NHOST_BACKEND_URL=YOUR_NHOST_BACKEND_URL
|
REACT_APP_NHOST_SUBDOMAIN=YOUR_NHOST_APP_SUBDOMAIN
|
||||||
|
REACT_APP_NHOST_REGION=YOUR_NHOST_APP_REGION
|
||||||
```
|
```
|
||||||
|
|
||||||
You can find your Nhost backend URL for your project from [your dashboard](https://app.nhost.io) as shown below:
|
You find your Nhost app's subdomain and region in [the app dashboard](https://app.nhost.io):
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
:::caution
|
:::caution
|
||||||
Don't forget to restart your React server after saving your `.env.local`
|
Don't forget to restart your React server after saving your `.env.local`
|
||||||
|
|||||||
@@ -136,7 +136,8 @@ import { NhostClient } from '@nhost/nhost-js'
|
|||||||
|
|
||||||
// highlight-start
|
// highlight-start
|
||||||
const nhostClient = new NhostClient({
|
const nhostClient = new NhostClient({
|
||||||
backendUrl: process.env.NHOST_BACKEND_URL
|
subdomain: process.env.NHOST_SUBDOMAIN
|
||||||
|
region: process.env.NHOST_REGION
|
||||||
})
|
})
|
||||||
// highlight-end
|
// highlight-end
|
||||||
|
|
||||||
@@ -175,16 +176,16 @@ const App = () => (
|
|||||||
|
|
||||||
That prop avoids having an additional request to fetch the current user.
|
That prop avoids having an additional request to fetch the current user.
|
||||||
|
|
||||||
Next, make sure to create an environment variable named
|
Next, store the environment variables for `subdomain` and `region` in `.env`:
|
||||||
`NHOST_BACKEND_URL` to store your Nhost backend URL:
|
|
||||||
|
|
||||||
```yaml title=".env"
|
```yaml title=".env"
|
||||||
NHOST_BACKEND_URL=YOUR_NHOST_BACKEND_URL
|
NHOST_SUBDOMAIN=YOUR_NHOST_APP_SUBDOMAIN
|
||||||
|
NHOST_REGION=YOUR_NHOST_APP_REGION
|
||||||
```
|
```
|
||||||
|
|
||||||
You can find your Nhost backend URL for your project from [your dashboard](https://app.nhost.io) as shown below:
|
You find your Nhost app's subdomain and region in [the app dashboard](https://app.nhost.io):
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Finally, we need to customize the GraphQL Endpoint for our RedwoodJS app. Indeed, by default, RedwoodJS provides a built-in GraphQL server under the `api` side. However, as we already have our own GraphQL server through Nhost and Hasura, we do not need it.
|
Finally, we need to customize the GraphQL Endpoint for our RedwoodJS app. Indeed, by default, RedwoodJS provides a built-in GraphQL server under the `api` side. However, as we already have our own GraphQL server through Nhost and Hasura, we do not need it.
|
||||||
|
|
||||||
@@ -194,7 +195,7 @@ So, open the RedwoodJS configuration file, `redwood.toml`, and change the GraphQ
|
|||||||
[web]
|
[web]
|
||||||
apiUrl = "/.redwood/functions"
|
apiUrl = "/.redwood/functions"
|
||||||
# highlight-next-line
|
# highlight-next-line
|
||||||
apiGraphQLUrl = "${NHOST_BACKEND_URL}/v1/graphql"
|
apiGraphQLUrl = "https://${NHOST_SUBDOMAIN}.graphql.${NHOST_REGION}.nhost.run/v1"
|
||||||
```
|
```
|
||||||
|
|
||||||
:::caution
|
:::caution
|
||||||
|
|||||||
@@ -153,7 +153,8 @@ import 'uno.css'
|
|||||||
|
|
||||||
// highlight-start
|
// highlight-start
|
||||||
const nhost = new NhostClient({
|
const nhost = new NhostClient({
|
||||||
backendUrl: import.meta.env.VITE_NHOST_URL
|
subdomain: import.meta.env.VITE_NHOST_SUBDOMAIN
|
||||||
|
region: import.meta.env.VITE_NHOST_REGION
|
||||||
})
|
})
|
||||||
// highlight-end
|
// highlight-end
|
||||||
|
|
||||||
@@ -170,16 +171,16 @@ app
|
|||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, make sure to create an environment variable named
|
Finally, store the environment variables for `subdomain` and `region` in `.env`:
|
||||||
`VITE_NHOST_URL` to store your Nhost backend URL:
|
|
||||||
|
|
||||||
```bash title=".env"
|
```yaml title=".env.development"
|
||||||
VITE_NHOST_URL=YOUR_NHOST_BACKEND_URL
|
VITE_NHOST_SUBDOMAIN=YOUR_NHOST_APP_SUBDOMAIN
|
||||||
|
VITE_NHOST_REGION=YOUR_NHOST_APP_REGION
|
||||||
```
|
```
|
||||||
|
|
||||||
You can find your Nhost backend URL for your project from [your dashboard](https://app.nhost.io) as shown below:
|
You find your Nhost app's subdomain and region in [the app dashboard](https://app.nhost.io):
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Build the app
|
## Build the app
|
||||||
|
|
||||||
|
|||||||
@@ -22,4 +22,6 @@ type Provider =
|
|||||||
| 'strava'
|
| 'strava'
|
||||||
| 'gitlab'
|
| 'gitlab'
|
||||||
| 'bitbucket'
|
| 'bitbucket'
|
||||||
|
| 'discord'
|
||||||
|
| 'twitch'
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
|
title: useSignInSmsPasswordless()
|
||||||
|
sidebar_label: useSignInSmsPasswordless()
|
||||||
|
slug: /reference/nextjs/use-sign-in-sms-passwordless
|
||||||
|
description: Use the hook `useSignInSmsPasswordless` to sign in a user with a one-time password sent via SMS to a phone.
|
||||||
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignInSmsPasswordless.ts#L57
|
||||||
|
---
|
||||||
|
|
||||||
|
# `useSignInSmsPasswordless()`
|
||||||
|
|
||||||
|
Use the hook `useSignInSmsPasswordless` to sign in a user with a one-time password sent via SMS to a phone.
|
||||||
|
|
||||||
|
1. The `signInSmsPasswordless` action sends a one-time password to the given phone number.
|
||||||
|
2. The client is then awaiting the OTP. `needsOtp` equals true.
|
||||||
|
3. After the code is received by SMS, the client sends the code with `sendOtp`. On success, the client is authenticated, and `isSuccess` equals `true`.
|
||||||
|
|
||||||
|
Any error is monitored through `isError` and `error`. While the `signInSmsPasswordless` and `sendOtp` actions are running, `isLoading` equals `true`.
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
const {
|
||||||
|
signInSmsPasswordless,
|
||||||
|
sendOtp,
|
||||||
|
needsOtp,
|
||||||
|
isLoading,
|
||||||
|
isSuccess,
|
||||||
|
isError,
|
||||||
|
error
|
||||||
|
} = useSignInSmsPasswordless()
|
||||||
|
|
||||||
|
console.log({ isLoading, isSuccess, isError, error })
|
||||||
|
|
||||||
|
const askCode = async (e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
await signInSmsPasswordless('+32455555555')
|
||||||
|
}
|
||||||
|
|
||||||
|
const sendCode = async (e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
await sendOtp('123456')
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">stateOptions</span>** <span className="optional-status">optional</span> `PasswordlessOptions`
|
||||||
|
|
||||||
|
---
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
|
title: SignInSmsPasswordlessHandler
|
||||||
|
sidebar_label: SignInSmsPasswordlessHandler
|
||||||
|
description: No description provided.
|
||||||
|
displayed_sidebar: referenceSidebar
|
||||||
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignInSmsPasswordless.ts#L14
|
||||||
|
---
|
||||||
|
|
||||||
|
# `SignInSmsPasswordlessHandler`
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
---
|
||||||
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
|
title: SignInSmsPasswordlessHookResult
|
||||||
|
sidebar_label: SignInSmsPasswordlessHookResult
|
||||||
|
description: No description provided.
|
||||||
|
displayed_sidebar: referenceSidebar
|
||||||
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignInSmsPasswordless.ts#L23
|
||||||
|
---
|
||||||
|
|
||||||
|
# `SignInSmsPasswordlessHookResult`
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">needsOtp</span>** <span className="optional-status">required</span> `boolean`
|
||||||
|
|
||||||
|
Returns true when the one-time password has been sent over by SMS, and the user needs to send it back to complete sign-in.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||||
|
|
||||||
|
**`@returns`**
|
||||||
|
|
||||||
|
`true` if an error occurred
|
||||||
|
|
||||||
|
**`@depreacted`**
|
||||||
|
|
||||||
|
use `!isSuccess` or `!!error` instead
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> `null` | `ErrorPayload`
|
||||||
|
|
||||||
|
Provides details about the error
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">isLoading</span>** <span className="optional-status">required</span> `boolean`
|
||||||
|
|
||||||
|
**`@returns`**
|
||||||
|
|
||||||
|
`true` when the action is executing, `false` when it finished its execution.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">isSuccess</span>** <span className="optional-status">required</span> `boolean`
|
||||||
|
|
||||||
|
Returns `true` if the action is successful.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">signInSmsPasswordless</span>** <span className="optional-status">required</span> [`SignInSmsPasswordlessHandler`](/reference/docgen/nextjs/types/sign-in-sms-passwordless-handler)
|
||||||
|
|
||||||
|
Sends a one-time code to the given phoneNumber
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">sendOtp</span>** <span className="optional-status">required</span> [`SignInSmsPasswordlessOtpHandler`](/reference/docgen/nextjs/types/sign-in-sms-passwordless-otp-handler)
|
||||||
|
|
||||||
|
---
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
|
title: SignInSmsPasswordlessOtpHandler
|
||||||
|
sidebar_label: SignInSmsPasswordlessOtpHandler
|
||||||
|
description: No description provided.
|
||||||
|
displayed_sidebar: referenceSidebar
|
||||||
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignInSmsPasswordless.ts#L18
|
||||||
|
---
|
||||||
|
|
||||||
|
# `SignInSmsPasswordlessOtpHandler`
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
|
title: useSignInSmsPasswordless()
|
||||||
|
sidebar_label: useSignInSmsPasswordless()
|
||||||
|
slug: /reference/react/use-sign-in-sms-passwordless
|
||||||
|
description: Use the hook `useSignInSmsPasswordless` to sign in a user with a one-time password sent via SMS to a phone.
|
||||||
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignInSmsPasswordless.ts#L57
|
||||||
|
---
|
||||||
|
|
||||||
|
# `useSignInSmsPasswordless()`
|
||||||
|
|
||||||
|
Use the hook `useSignInSmsPasswordless` to sign in a user with a one-time password sent via SMS to a phone.
|
||||||
|
|
||||||
|
1. The `signInSmsPasswordless` action sends a one-time password to the given phone number.
|
||||||
|
2. The client is then awaiting the OTP. `needsOtp` equals true.
|
||||||
|
3. After the code is received by SMS, the client sends the code with `sendOtp`. On success, the client is authenticated, and `isSuccess` equals `true`.
|
||||||
|
|
||||||
|
Any error is monitored through `isError` and `error`. While the `signInSmsPasswordless` and `sendOtp` actions are running, `isLoading` equals `true`.
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
const {
|
||||||
|
signInSmsPasswordless,
|
||||||
|
sendOtp,
|
||||||
|
needsOtp,
|
||||||
|
isLoading,
|
||||||
|
isSuccess,
|
||||||
|
isError,
|
||||||
|
error
|
||||||
|
} = useSignInSmsPasswordless()
|
||||||
|
|
||||||
|
console.log({ isLoading, isSuccess, isError, error })
|
||||||
|
|
||||||
|
const askCode = async (e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
await signInSmsPasswordless('+32455555555')
|
||||||
|
}
|
||||||
|
|
||||||
|
const sendCode = async (e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
await sendOtp('123456')
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">stateOptions</span>** <span className="optional-status">optional</span> `PasswordlessOptions`
|
||||||
|
|
||||||
|
---
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
|
title: SignInSmsPasswordlessHandler
|
||||||
|
sidebar_label: SignInSmsPasswordlessHandler
|
||||||
|
description: No description provided.
|
||||||
|
displayed_sidebar: referenceSidebar
|
||||||
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignInSmsPasswordless.ts#L14
|
||||||
|
---
|
||||||
|
|
||||||
|
# `SignInSmsPasswordlessHandler`
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
---
|
||||||
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
|
title: SignInSmsPasswordlessHookResult
|
||||||
|
sidebar_label: SignInSmsPasswordlessHookResult
|
||||||
|
description: No description provided.
|
||||||
|
displayed_sidebar: referenceSidebar
|
||||||
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignInSmsPasswordless.ts#L23
|
||||||
|
---
|
||||||
|
|
||||||
|
# `SignInSmsPasswordlessHookResult`
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">needsOtp</span>** <span className="optional-status">required</span> `boolean`
|
||||||
|
|
||||||
|
Returns true when the one-time password has been sent over by SMS, and the user needs to send it back to complete sign-in.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||||
|
|
||||||
|
**`@returns`**
|
||||||
|
|
||||||
|
`true` if an error occurred
|
||||||
|
|
||||||
|
**`@depreacted`**
|
||||||
|
|
||||||
|
use `!isSuccess` or `!!error` instead
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> `null` | `ErrorPayload`
|
||||||
|
|
||||||
|
Provides details about the error
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">isLoading</span>** <span className="optional-status">required</span> `boolean`
|
||||||
|
|
||||||
|
**`@returns`**
|
||||||
|
|
||||||
|
`true` when the action is executing, `false` when it finished its execution.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">isSuccess</span>** <span className="optional-status">required</span> `boolean`
|
||||||
|
|
||||||
|
Returns `true` if the action is successful.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">signInSmsPasswordless</span>** <span className="optional-status">required</span> [`SignInSmsPasswordlessHandler`](/reference/docgen/react/types/sign-in-sms-passwordless-handler)
|
||||||
|
|
||||||
|
Sends a one-time code to the given phoneNumber
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">sendOtp</span>** <span className="optional-status">required</span> [`SignInSmsPasswordlessOtpHandler`](/reference/docgen/react/types/sign-in-sms-passwordless-otp-handler)
|
||||||
|
|
||||||
|
---
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
|
title: SignInSmsPasswordlessOtpHandler
|
||||||
|
sidebar_label: SignInSmsPasswordlessOtpHandler
|
||||||
|
description: No description provided.
|
||||||
|
displayed_sidebar: referenceSidebar
|
||||||
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useSignInSmsPasswordless.ts#L18
|
||||||
|
---
|
||||||
|
|
||||||
|
# `SignInSmsPasswordlessOtpHandler`
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
|
title: useSignInSmsPasswordless()
|
||||||
|
sidebar_label: useSignInSmsPasswordless()
|
||||||
|
slug: /reference/vue/use-sign-in-sms-passwordless
|
||||||
|
description: Use the composable `useSignInSmsPasswordless` to sign in a user with a one-time password sent via SMS to a phone.
|
||||||
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/vue/src/useSignInSmsPasswordless.ts#L65
|
||||||
|
---
|
||||||
|
|
||||||
|
# `useSignInSmsPasswordless()`
|
||||||
|
|
||||||
|
Use the composable `useSignInSmsPasswordless` to sign in a user with a one-time password sent via SMS to a phone.
|
||||||
|
|
||||||
|
1. The `signInSmsPasswordless` action sends a one-time password to the given phone number.
|
||||||
|
2. The client is then awaiting the OTP. `needsOtp` equals true.
|
||||||
|
3. After the code is received by SMS, the client sends the code with `sendOtp`. On success, the client is authenticated, and `isSuccess` equals `true`.
|
||||||
|
|
||||||
|
Any error is monitored through `isError` and `error`. While the `signInSmsPasswordless` and `sendOtp` actions are running, `isLoading` equals `true`.
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
const {
|
||||||
|
signInSmsPasswordless,
|
||||||
|
sendOtp,
|
||||||
|
needsOtp,
|
||||||
|
isLoading,
|
||||||
|
isSuccess,
|
||||||
|
isError,
|
||||||
|
error
|
||||||
|
} = useSignInSmsPasswordless()
|
||||||
|
|
||||||
|
console.log({ isLoading, isSuccess, isError, error })
|
||||||
|
|
||||||
|
const askCode = async (e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
await signInSmsPasswordless('+32455555555')
|
||||||
|
}
|
||||||
|
|
||||||
|
const sendCode = async (e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
await sendOtp('123456')
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">stateOptions</span>** <span className="optional-status">optional</span> `NestedRefOfValue<undefined | PasswordlessOptions>`
|
||||||
|
|
||||||
|
---
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
---
|
||||||
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
|
title: SignInSmsPasswordlessComposableResult
|
||||||
|
sidebar_label: SignInSmsPasswordlessComposableResult
|
||||||
|
description: No description provided.
|
||||||
|
displayed_sidebar: referenceSidebar
|
||||||
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/vue/src/useSignInSmsPasswordless.ts#L31
|
||||||
|
---
|
||||||
|
|
||||||
|
# `SignInSmsPasswordlessComposableResult`
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">needsOtp</span>** <span className="optional-status">required</span> `Ref<boolean>`
|
||||||
|
|
||||||
|
Returns true when the one-time password has been sent over by SMS, and the user needs to send it back to complete sign-in.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `Ref<boolean>`
|
||||||
|
|
||||||
|
**`@returns`**
|
||||||
|
|
||||||
|
`true` if an error occurred
|
||||||
|
|
||||||
|
**`@depreacted`**
|
||||||
|
|
||||||
|
use `!isSuccess` or `!!error` instead
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> `Ref<null | ErrorPayload>`
|
||||||
|
|
||||||
|
Provides details about the error
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">isLoading</span>** <span className="optional-status">required</span> `Ref<boolean>`
|
||||||
|
|
||||||
|
**`@returns`**
|
||||||
|
|
||||||
|
`true` when the action is executing, `false` when it finished its execution.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">isSuccess</span>** <span className="optional-status">required</span> `Ref<boolean>`
|
||||||
|
|
||||||
|
Returns `true` if the action is successful.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">signInSmsPasswordless</span>** <span className="optional-status">required</span> [`SignInSmsPasswordlessHandler`](/reference/docgen/vue/types/sign-in-sms-passwordless-handler)
|
||||||
|
|
||||||
|
Sends a one-time code to the given phoneNumber
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**<span className="parameter-name">sendOtp</span>** <span className="optional-status">required</span> [`SignInSmsPasswordlessOtpHandler`](/reference/docgen/vue/types/sign-in-sms-passwordless-otp-handler)
|
||||||
|
|
||||||
|
---
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
|
title: SignInSmsPasswordlessHandler
|
||||||
|
sidebar_label: SignInSmsPasswordlessHandler
|
||||||
|
description: No description provided.
|
||||||
|
displayed_sidebar: referenceSidebar
|
||||||
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/vue/src/useSignInSmsPasswordless.ts#L16
|
||||||
|
---
|
||||||
|
|
||||||
|
# `SignInSmsPasswordlessHandler`
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||||
|
title: SignInSmsPasswordlessOtpHandler
|
||||||
|
sidebar_label: SignInSmsPasswordlessOtpHandler
|
||||||
|
description: No description provided.
|
||||||
|
displayed_sidebar: referenceSidebar
|
||||||
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/vue/src/useSignInSmsPasswordless.ts#L23
|
||||||
|
---
|
||||||
|
|
||||||
|
# `SignInSmsPasswordlessOtpHandler`
|
||||||
@@ -39,7 +39,8 @@ import { NhostApolloProvider } from '@nhost/react-apollo'
|
|||||||
import { NhostClient, NhostReactProvider } from '@nhost/react'
|
import { NhostClient, NhostReactProvider } from '@nhost/react'
|
||||||
|
|
||||||
const nhost = new NhostClient({
|
const nhost = new NhostClient({
|
||||||
backendUrl: '<Your Nhost Backend URL>'
|
subdomain: '<app-subdomain>',
|
||||||
|
region: '<app-region>'
|
||||||
})
|
})
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
|
|||||||
@@ -35,10 +35,12 @@ After installation, initialize a single Nhost Client (`nhost`) under `src/lib/nh
|
|||||||
|
|
||||||
```jsx title=src/lib/nhost.js
|
```jsx title=src/lib/nhost.js
|
||||||
import { NhostClient } from '@nhost/react'
|
import { NhostClient } from '@nhost/react'
|
||||||
|
|
||||||
const nhost = new NhostClient({
|
const nhost = new NhostClient({
|
||||||
subdomain: '<your-subdomain>',
|
subdomain: '<your-subdomain>',
|
||||||
region: '<your-region>'
|
region: '<your-region>'
|
||||||
})
|
})
|
||||||
|
|
||||||
export { nhost }
|
export { nhost }
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/docs",
|
"name": "@nhost/docs",
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"docusaurus": "docusaurus",
|
"docusaurus": "docusaurus",
|
||||||
|
|||||||
BIN
docs/static/img/og/platform/sign-in-with-apple.png
vendored
Normal file
|
After Width: | Height: | Size: 165 KiB |
BIN
docs/static/img/og/platform/sign-in-with-discord.png
vendored
Normal file
|
After Width: | Height: | Size: 165 KiB |
BIN
docs/static/img/og/platform/sign-in-with-twitch.png
vendored
Normal file
|
After Width: | Height: | Size: 160 KiB |
BIN
docs/static/img/quickstarts/app-dashboard.png
vendored
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 208 KiB |
16
docs/static/img/social-providers/apple-preview.svg
vendored
Normal file
|
After Width: | Height: | Size: 22 KiB |
1
docs/static/img/social-providers/discord-preview.svg
vendored
Normal file
|
After Width: | Height: | Size: 67 KiB |
1
docs/static/img/social-providers/twitch-preview.svg
vendored
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
docs/static/videos/add-user.mp4
vendored
BIN
docs/static/videos/open-hasura-console.mp4
vendored
27
examples/codegen-react-apollo/.gitignore
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
/.pnp
|
||||||
|
.pnp.js
|
||||||
|
|
||||||
|
# testing
|
||||||
|
/coverage
|
||||||
|
|
||||||
|
# production
|
||||||
|
/build
|
||||||
|
|
||||||
|
# misc
|
||||||
|
.DS_Store
|
||||||
|
.env.local
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
.nhost
|
||||||
|
web/node_modules
|
||||||
|
node_modules
|
||||||
|
functions/node_modules
|
||||||
46
examples/codegen-react-apollo/README.md
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
# GraphQL Code Generator Example Repo
|
||||||
|
|
||||||
|
This is an example repo for how to use GraphQL Code Generator together with:
|
||||||
|
|
||||||
|
- TypeScript
|
||||||
|
- React
|
||||||
|
- Apollo Client
|
||||||
|
- Nhost
|
||||||
|
|
||||||
|
This repo is a reference repo for the blog post: [How to use GraphQL Code Generator with React and Apollo](https://nhost.io/blog/how-to-use-graphql-code-generator-with-react-and-apollo).
|
||||||
|
|
||||||
|
## Get Started
|
||||||
|
|
||||||
|
### Run npm Packages in Dev Mode
|
||||||
|
|
||||||
|
In the root of the `nhost/nhost` repo:
|
||||||
|
|
||||||
|
Install dependencies with `pnpm`:
|
||||||
|
|
||||||
|
> It's important that you're using `pnpm` because our repo are using [PNPM Workspaces](https://pnpm.io/workspaces).
|
||||||
|
|
||||||
|
```
|
||||||
|
pnpm install
|
||||||
|
```
|
||||||
|
|
||||||
|
Running packages in development mode:
|
||||||
|
|
||||||
|
```
|
||||||
|
pnpm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Run Nhost
|
||||||
|
|
||||||
|
In this folder:
|
||||||
|
|
||||||
|
```
|
||||||
|
nhost up
|
||||||
|
```
|
||||||
|
|
||||||
|
### Run React App
|
||||||
|
|
||||||
|
In this folder:
|
||||||
|
|
||||||
|
```
|
||||||
|
pnpm run dev
|
||||||
|
```
|
||||||
14
examples/codegen-react-apollo/graphql.config.yaml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
schema:
|
||||||
|
- http://localhost:1337/v1/graphql:
|
||||||
|
headers:
|
||||||
|
x-hasura-admin-secret: nhost-admin-secret
|
||||||
|
documents:
|
||||||
|
- 'src/**/*.graphql'
|
||||||
|
generates:
|
||||||
|
src/utils/__generated__/graphql.ts:
|
||||||
|
plugins:
|
||||||
|
- 'typescript'
|
||||||
|
- 'typescript-operations'
|
||||||
|
- 'typescript-react-apollo'
|
||||||
|
config:
|
||||||
|
withRefetchFn: true
|
||||||
14
examples/codegen-react-apollo/index.html
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" href="/favicon.ico" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>GraphQL Code Generator Example with React and Apollo Client</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="root"></div>
|
||||||
|
<script type="module" src="/src/index.tsx"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
144
examples/codegen-react-apollo/nhost/config.yaml
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
metadata_directory: metadata
|
||||||
|
services:
|
||||||
|
mailhog:
|
||||||
|
port: 8025
|
||||||
|
hasura:
|
||||||
|
version: v2.8.0
|
||||||
|
environment:
|
||||||
|
hasura_graphql_enable_remote_schema_permissions: false
|
||||||
|
auth:
|
||||||
|
version: 0.10.0
|
||||||
|
storage:
|
||||||
|
version: 0.2.3
|
||||||
|
minio:
|
||||||
|
environment:
|
||||||
|
minio_root_password: minioaccesskey123123
|
||||||
|
minio_root_user: minioaccesskey123123
|
||||||
|
postgres:
|
||||||
|
environment:
|
||||||
|
postgres_password: postgres
|
||||||
|
postgres_user: postgres
|
||||||
|
auth:
|
||||||
|
access_control:
|
||||||
|
email:
|
||||||
|
allowed_email_domains: ''
|
||||||
|
allowed_emails: ''
|
||||||
|
blocked_email_domains: ''
|
||||||
|
blocked_emails: ''
|
||||||
|
url:
|
||||||
|
allowed_redirect_urls: ''
|
||||||
|
anonymous_users_enabled: false
|
||||||
|
client_url: http://localhost:3000
|
||||||
|
disable_new_users: false
|
||||||
|
email:
|
||||||
|
enabled: false
|
||||||
|
passwordless:
|
||||||
|
enabled: false
|
||||||
|
signin_email_verified_required: true
|
||||||
|
template_fetch_url: ''
|
||||||
|
gravatar:
|
||||||
|
default: ''
|
||||||
|
enabled: true
|
||||||
|
rating: ''
|
||||||
|
locale:
|
||||||
|
allowed: en
|
||||||
|
default: en
|
||||||
|
password:
|
||||||
|
hibp_enabled: false
|
||||||
|
min_length: 3
|
||||||
|
provider:
|
||||||
|
apple:
|
||||||
|
client_id: ''
|
||||||
|
enabled: false
|
||||||
|
key_id: ''
|
||||||
|
private_key: ''
|
||||||
|
scope: name,email
|
||||||
|
team_id: ''
|
||||||
|
bitbucket:
|
||||||
|
client_id: ''
|
||||||
|
client_secret: ''
|
||||||
|
enabled: false
|
||||||
|
facebook:
|
||||||
|
client_id: ''
|
||||||
|
client_secret: ''
|
||||||
|
enabled: false
|
||||||
|
scope: email,photos,displayName
|
||||||
|
github:
|
||||||
|
client_id: ''
|
||||||
|
client_secret: ''
|
||||||
|
enabled: false
|
||||||
|
scope: user:email
|
||||||
|
token_url: ''
|
||||||
|
user_profile_url: ''
|
||||||
|
gitlab:
|
||||||
|
base_url: ''
|
||||||
|
client_id: ''
|
||||||
|
client_secret: ''
|
||||||
|
enabled: false
|
||||||
|
scope: read_user
|
||||||
|
google:
|
||||||
|
client_id: ''
|
||||||
|
client_secret: ''
|
||||||
|
enabled: false
|
||||||
|
scope: email,profile
|
||||||
|
linkedin:
|
||||||
|
client_id: ''
|
||||||
|
client_secret: ''
|
||||||
|
enabled: false
|
||||||
|
scope: r_emailaddress,r_liteprofile
|
||||||
|
spotify:
|
||||||
|
client_id: ''
|
||||||
|
client_secret: ''
|
||||||
|
enabled: false
|
||||||
|
scope: user-read-email,user-read-private
|
||||||
|
strava:
|
||||||
|
client_id: ''
|
||||||
|
client_secret: ''
|
||||||
|
enabled: false
|
||||||
|
twilio:
|
||||||
|
account_sid: ''
|
||||||
|
auth_token: ''
|
||||||
|
enabled: false
|
||||||
|
messaging_service_id: ''
|
||||||
|
twitter:
|
||||||
|
consumer_key: ''
|
||||||
|
consumer_secret: ''
|
||||||
|
enabled: false
|
||||||
|
windows_live:
|
||||||
|
client_id: ''
|
||||||
|
client_secret: ''
|
||||||
|
enabled: false
|
||||||
|
scope: wl.basic,wl.emails,wl.contacts_emails
|
||||||
|
sms:
|
||||||
|
enabled: false
|
||||||
|
passwordless:
|
||||||
|
enabled: false
|
||||||
|
provider:
|
||||||
|
twilio:
|
||||||
|
account_sid: ''
|
||||||
|
auth_token: ''
|
||||||
|
from: ''
|
||||||
|
messaging_service_id: ''
|
||||||
|
smtp:
|
||||||
|
host: nhost_mailhog
|
||||||
|
method: ''
|
||||||
|
pass: password
|
||||||
|
port: 1706
|
||||||
|
secure: false
|
||||||
|
sender: hasura-auth@example.com
|
||||||
|
user: user
|
||||||
|
token:
|
||||||
|
access:
|
||||||
|
expires_in: 900
|
||||||
|
refresh:
|
||||||
|
expires_in: 43200
|
||||||
|
user:
|
||||||
|
allowed_roles: user,me
|
||||||
|
default_allowed_roles: user,me
|
||||||
|
default_role: user
|
||||||
|
mfa:
|
||||||
|
enabled: false
|
||||||
|
issuer: nhost
|
||||||
|
storage:
|
||||||
|
force_download_for_content_types: text/html,application/javascript
|
||||||
|
version: 3
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h2>Confirm Email Change</h2>
|
||||||
|
<p>Use this link to confirm changing email:</p>
|
||||||
|
<p>
|
||||||
|
<a href="${link}">
|
||||||
|
Change email
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Change your email address
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h2>Verify Email</h2>
|
||||||
|
<p>Use this link to verify your email:</p>
|
||||||
|
<p>
|
||||||
|
<a href="${link}">
|
||||||
|
Verify Email
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Verify your email
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h2>Reset Password</h2>
|
||||||
|
<p>Use this link to reset your password:</p>
|
||||||
|
<p>
|
||||||
|
<a href="${link}">
|
||||||
|
Reset password
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Reset your password
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h2>Magic Link</h2>
|
||||||
|
<p>Use this link to securely sign in:</p>
|
||||||
|
<p>
|
||||||
|
<a href="${link}">
|
||||||
|
Sign In
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Secure sign-in link
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h2>Confirmer changement de courriel</h2>
|
||||||
|
<p>Utilisez ce lien pour confirmer le changement de courriel:</p>
|
||||||
|
<p>
|
||||||
|
<a href="${link}">
|
||||||
|
Changer courriel
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Changez votre adresse courriel
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h2>Vérifiez votre courriel</h2>
|
||||||
|
<p>Utilisez ce lien pour vérifier votre courriel:</p>
|
||||||
|
<p>
|
||||||
|
<a href="${link}">
|
||||||
|
Vérifier courriel
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Vérifier votre courriel
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h2>Réinitializer votre mot de passe</h2>
|
||||||
|
<p>Utilisez ce lien pour réinitializer votre mot de passe:</p>
|
||||||
|
<p>
|
||||||
|
<a href="${link}">
|
||||||
|
Réinitializer mot de passe
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Réinitialiser votre mot de passe
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h2>Lien magique</h2>
|
||||||
|
<p>Utilisez ce lien pour vous connecter de façon sécuritaire:</p>
|
||||||
|
<p>
|
||||||
|
<a href="${link}">
|
||||||
|
Connexion
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Lien de connexion sécurisé
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
actions: []
|
||||||
|
custom_types:
|
||||||
|
enums: []
|
||||||
|
input_objects: []
|
||||||
|
objects: []
|
||||||
|
scalars: []
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
[]
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
[]
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
- name: default
|
||||||
|
kind: postgres
|
||||||
|
configuration:
|
||||||
|
connection_info:
|
||||||
|
database_url:
|
||||||
|
from_env: HASURA_GRAPHQL_DATABASE_URL
|
||||||
|
isolation_level: read-committed
|
||||||
|
pool_settings:
|
||||||
|
connection_lifetime: 600
|
||||||
|
idle_timeout: 180
|
||||||
|
max_connections: 50
|
||||||
|
retries: 1
|
||||||
|
use_prepared_statements: true
|
||||||
|
tables: "!include default/tables/tables.yaml"
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
table:
|
||||||
|
name: provider_requests
|
||||||
|
schema: auth
|
||||||
|
configuration:
|
||||||
|
column_config: {}
|
||||||
|
custom_column_names: {}
|
||||||
|
custom_name: authProviderRequests
|
||||||
|
custom_root_fields:
|
||||||
|
delete: deleteAuthProviderRequests
|
||||||
|
delete_by_pk: deleteAuthProviderRequest
|
||||||
|
insert: insertAuthProviderRequests
|
||||||
|
insert_one: insertAuthProviderRequest
|
||||||
|
select: authProviderRequests
|
||||||
|
select_aggregate: authProviderRequestsAggregate
|
||||||
|
select_by_pk: authProviderRequest
|
||||||
|
update: updateAuthProviderRequests
|
||||||
|
update_by_pk: updateAuthProviderRequest
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
table:
|
||||||
|
name: providers
|
||||||
|
schema: auth
|
||||||
|
configuration:
|
||||||
|
column_config: {}
|
||||||
|
custom_column_names: {}
|
||||||
|
custom_name: authProviders
|
||||||
|
custom_root_fields:
|
||||||
|
delete: deleteAuthProviders
|
||||||
|
delete_by_pk: deleteAuthProvider
|
||||||
|
insert: insertAuthProviders
|
||||||
|
insert_one: insertAuthProvider
|
||||||
|
select: authProviders
|
||||||
|
select_aggregate: authProvidersAggregate
|
||||||
|
select_by_pk: authProvider
|
||||||
|
update: updateAuthProviders
|
||||||
|
update_by_pk: updateAuthProvider
|
||||||
|
array_relationships:
|
||||||
|
- name: userProviders
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on:
|
||||||
|
column: provider_id
|
||||||
|
table:
|
||||||
|
name: user_providers
|
||||||
|
schema: auth
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
table:
|
||||||
|
name: refresh_tokens
|
||||||
|
schema: auth
|
||||||
|
configuration:
|
||||||
|
column_config:
|
||||||
|
created_at:
|
||||||
|
custom_name: createdAt
|
||||||
|
expires_at:
|
||||||
|
custom_name: expiresAt
|
||||||
|
refresh_token:
|
||||||
|
custom_name: refreshToken
|
||||||
|
user_id:
|
||||||
|
custom_name: userId
|
||||||
|
custom_column_names:
|
||||||
|
created_at: createdAt
|
||||||
|
expires_at: expiresAt
|
||||||
|
refresh_token: refreshToken
|
||||||
|
user_id: userId
|
||||||
|
custom_name: authRefreshTokens
|
||||||
|
custom_root_fields:
|
||||||
|
delete: deleteAuthRefreshTokens
|
||||||
|
delete_by_pk: deleteAuthRefreshToken
|
||||||
|
insert: insertAuthRefreshTokens
|
||||||
|
insert_one: insertAuthRefreshToken
|
||||||
|
select: authRefreshTokens
|
||||||
|
select_aggregate: authRefreshTokensAggregate
|
||||||
|
select_by_pk: authRefreshToken
|
||||||
|
update: updateAuthRefreshTokens
|
||||||
|
update_by_pk: updateAuthRefreshToken
|
||||||
|
object_relationships:
|
||||||
|
- name: user
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on: user_id
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
table:
|
||||||
|
name: roles
|
||||||
|
schema: auth
|
||||||
|
configuration:
|
||||||
|
column_config: {}
|
||||||
|
custom_column_names: {}
|
||||||
|
custom_name: authRoles
|
||||||
|
custom_root_fields:
|
||||||
|
delete: deleteAuthRoles
|
||||||
|
delete_by_pk: deleteAuthRole
|
||||||
|
insert: insertAuthRoles
|
||||||
|
insert_one: insertAuthRole
|
||||||
|
select: authRoles
|
||||||
|
select_aggregate: authRolesAggregate
|
||||||
|
select_by_pk: authRole
|
||||||
|
update: updateAuthRoles
|
||||||
|
update_by_pk: updateAuthRole
|
||||||
|
array_relationships:
|
||||||
|
- name: userRoles
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on:
|
||||||
|
column: role
|
||||||
|
table:
|
||||||
|
name: user_roles
|
||||||
|
schema: auth
|
||||||
|
- name: usersByDefaultRole
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on:
|
||||||
|
column: default_role
|
||||||
|
table:
|
||||||
|
name: users
|
||||||
|
schema: auth
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
table:
|
||||||
|
name: user_providers
|
||||||
|
schema: auth
|
||||||
|
configuration:
|
||||||
|
column_config:
|
||||||
|
access_token:
|
||||||
|
custom_name: accessToken
|
||||||
|
created_at:
|
||||||
|
custom_name: createdAt
|
||||||
|
provider_id:
|
||||||
|
custom_name: providerId
|
||||||
|
provider_user_id:
|
||||||
|
custom_name: providerUserId
|
||||||
|
refresh_token:
|
||||||
|
custom_name: refreshToken
|
||||||
|
updated_at:
|
||||||
|
custom_name: updatedAt
|
||||||
|
user_id:
|
||||||
|
custom_name: userId
|
||||||
|
custom_column_names:
|
||||||
|
access_token: accessToken
|
||||||
|
created_at: createdAt
|
||||||
|
provider_id: providerId
|
||||||
|
provider_user_id: providerUserId
|
||||||
|
refresh_token: refreshToken
|
||||||
|
updated_at: updatedAt
|
||||||
|
user_id: userId
|
||||||
|
custom_name: authUserProviders
|
||||||
|
custom_root_fields:
|
||||||
|
delete: deleteAuthUserProviders
|
||||||
|
delete_by_pk: deleteAuthUserProvider
|
||||||
|
insert: insertAuthUserProviders
|
||||||
|
insert_one: insertAuthUserProvider
|
||||||
|
select: authUserProviders
|
||||||
|
select_aggregate: authUserProvidersAggregate
|
||||||
|
select_by_pk: authUserProvider
|
||||||
|
update: updateAuthUserProviders
|
||||||
|
update_by_pk: updateAuthUserProvider
|
||||||
|
object_relationships:
|
||||||
|
- name: provider
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on: provider_id
|
||||||
|
- name: user
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on: user_id
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
table:
|
||||||
|
name: user_roles
|
||||||
|
schema: auth
|
||||||
|
configuration:
|
||||||
|
column_config:
|
||||||
|
created_at:
|
||||||
|
custom_name: createdAt
|
||||||
|
user_id:
|
||||||
|
custom_name: userId
|
||||||
|
custom_column_names:
|
||||||
|
created_at: createdAt
|
||||||
|
user_id: userId
|
||||||
|
custom_name: authUserRoles
|
||||||
|
custom_root_fields:
|
||||||
|
delete: deleteAuthUserRoles
|
||||||
|
delete_by_pk: deleteAuthUserRole
|
||||||
|
insert: insertAuthUserRoles
|
||||||
|
insert_one: insertAuthUserRole
|
||||||
|
select: authUserRoles
|
||||||
|
select_aggregate: authUserRolesAggregate
|
||||||
|
select_by_pk: authUserRole
|
||||||
|
update: updateAuthUserRoles
|
||||||
|
update_by_pk: updateAuthUserRole
|
||||||
|
object_relationships:
|
||||||
|
- name: roleByRole
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on: role
|
||||||
|
- name: user
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on: user_id
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
table:
|
||||||
|
name: users
|
||||||
|
schema: auth
|
||||||
|
configuration:
|
||||||
|
column_config:
|
||||||
|
active_mfa_type:
|
||||||
|
custom_name: activeMfaType
|
||||||
|
avatar_url:
|
||||||
|
custom_name: avatarUrl
|
||||||
|
created_at:
|
||||||
|
custom_name: createdAt
|
||||||
|
default_role:
|
||||||
|
custom_name: defaultRole
|
||||||
|
display_name:
|
||||||
|
custom_name: displayName
|
||||||
|
email_verified:
|
||||||
|
custom_name: emailVerified
|
||||||
|
is_anonymous:
|
||||||
|
custom_name: isAnonymous
|
||||||
|
last_seen:
|
||||||
|
custom_name: lastSeen
|
||||||
|
new_email:
|
||||||
|
custom_name: newEmail
|
||||||
|
otp_hash:
|
||||||
|
custom_name: otpHash
|
||||||
|
otp_hash_expires_at:
|
||||||
|
custom_name: otpHashExpiresAt
|
||||||
|
otp_method_last_used:
|
||||||
|
custom_name: otpMethodLastUsed
|
||||||
|
password_hash:
|
||||||
|
custom_name: passwordHash
|
||||||
|
phone_number:
|
||||||
|
custom_name: phoneNumber
|
||||||
|
phone_number_verified:
|
||||||
|
custom_name: phoneNumberVerified
|
||||||
|
ticket_expires_at:
|
||||||
|
custom_name: ticketExpiresAt
|
||||||
|
totp_secret:
|
||||||
|
custom_name: totpSecret
|
||||||
|
updated_at:
|
||||||
|
custom_name: updatedAt
|
||||||
|
custom_column_names:
|
||||||
|
active_mfa_type: activeMfaType
|
||||||
|
avatar_url: avatarUrl
|
||||||
|
created_at: createdAt
|
||||||
|
default_role: defaultRole
|
||||||
|
display_name: displayName
|
||||||
|
email_verified: emailVerified
|
||||||
|
is_anonymous: isAnonymous
|
||||||
|
last_seen: lastSeen
|
||||||
|
new_email: newEmail
|
||||||
|
otp_hash: otpHash
|
||||||
|
otp_hash_expires_at: otpHashExpiresAt
|
||||||
|
otp_method_last_used: otpMethodLastUsed
|
||||||
|
password_hash: passwordHash
|
||||||
|
phone_number: phoneNumber
|
||||||
|
phone_number_verified: phoneNumberVerified
|
||||||
|
ticket_expires_at: ticketExpiresAt
|
||||||
|
totp_secret: totpSecret
|
||||||
|
updated_at: updatedAt
|
||||||
|
custom_name: users
|
||||||
|
custom_root_fields:
|
||||||
|
delete: deleteUsers
|
||||||
|
delete_by_pk: deleteUser
|
||||||
|
insert: insertUsers
|
||||||
|
insert_one: insertUser
|
||||||
|
select: users
|
||||||
|
select_aggregate: usersAggregate
|
||||||
|
select_by_pk: user
|
||||||
|
update: updateUsers
|
||||||
|
update_by_pk: updateUser
|
||||||
|
object_relationships:
|
||||||
|
- name: defaultRoleByRole
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on: default_role
|
||||||
|
array_relationships:
|
||||||
|
- name: refreshTokens
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on:
|
||||||
|
column: user_id
|
||||||
|
table:
|
||||||
|
name: refresh_tokens
|
||||||
|
schema: auth
|
||||||
|
- name: roles
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on:
|
||||||
|
column: user_id
|
||||||
|
table:
|
||||||
|
name: user_roles
|
||||||
|
schema: auth
|
||||||
|
- name: userProviders
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on:
|
||||||
|
column: user_id
|
||||||
|
table:
|
||||||
|
name: user_providers
|
||||||
|
schema: auth
|
||||||
|
select_permissions:
|
||||||
|
- permission:
|
||||||
|
columns:
|
||||||
|
- avatar_url
|
||||||
|
- display_name
|
||||||
|
- id
|
||||||
|
filter:
|
||||||
|
id:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
role: user
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
table:
|
||||||
|
name: customers
|
||||||
|
schema: public
|
||||||
|
insert_permissions:
|
||||||
|
- permission:
|
||||||
|
check: {}
|
||||||
|
columns:
|
||||||
|
- name
|
||||||
|
role: public
|
||||||
|
select_permissions:
|
||||||
|
- permission:
|
||||||
|
columns:
|
||||||
|
- id
|
||||||
|
- name
|
||||||
|
- created_at
|
||||||
|
filter: {}
|
||||||
|
role: public
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
table:
|
||||||
|
name: doc_links
|
||||||
|
schema: public
|
||||||
|
configuration:
|
||||||
|
column_config:
|
||||||
|
created_at:
|
||||||
|
custom_name: createdAt
|
||||||
|
doc_id:
|
||||||
|
custom_name: docId
|
||||||
|
download_allowed:
|
||||||
|
custom_name: downloadAllowed
|
||||||
|
is_active:
|
||||||
|
custom_name: isActive
|
||||||
|
require_email_to_view:
|
||||||
|
custom_name: requireEmailToView
|
||||||
|
updated_at:
|
||||||
|
custom_name: updatedAt
|
||||||
|
custom_column_names:
|
||||||
|
created_at: createdAt
|
||||||
|
doc_id: docId
|
||||||
|
download_allowed: downloadAllowed
|
||||||
|
is_active: isActive
|
||||||
|
require_email_to_view: requireEmailToView
|
||||||
|
updated_at: updatedAt
|
||||||
|
custom_root_fields:
|
||||||
|
insert: insertDocLinks
|
||||||
|
insert_one: insertDocLink
|
||||||
|
select: docLinks
|
||||||
|
select_by_pk: docLink
|
||||||
|
object_relationships:
|
||||||
|
- name: doc
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on: doc_id
|
||||||
|
array_relationships:
|
||||||
|
- name: docVisits
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on:
|
||||||
|
column: doc_link_id
|
||||||
|
table:
|
||||||
|
name: doc_visits
|
||||||
|
schema: public
|
||||||
|
insert_permissions:
|
||||||
|
- permission:
|
||||||
|
check:
|
||||||
|
doc:
|
||||||
|
user_id:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
columns:
|
||||||
|
- doc_id
|
||||||
|
- download_allowed
|
||||||
|
- is_active
|
||||||
|
- passcode
|
||||||
|
- require_email_to_view
|
||||||
|
role: user
|
||||||
|
select_permissions:
|
||||||
|
- permission:
|
||||||
|
columns:
|
||||||
|
- download_allowed
|
||||||
|
- id
|
||||||
|
- is_active
|
||||||
|
- passcode
|
||||||
|
- require_email_to_view
|
||||||
|
filter: {}
|
||||||
|
limit: 0
|
||||||
|
role: public
|
||||||
|
- permission:
|
||||||
|
columns:
|
||||||
|
- download_allowed
|
||||||
|
- is_active
|
||||||
|
- require_email_to_view
|
||||||
|
- passcode
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- doc_id
|
||||||
|
- id
|
||||||
|
filter:
|
||||||
|
doc:
|
||||||
|
user_id:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
role: user
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
table:
|
||||||
|
name: doc_visits
|
||||||
|
schema: public
|
||||||
|
configuration:
|
||||||
|
column_config:
|
||||||
|
created_at:
|
||||||
|
custom_name: createdAt
|
||||||
|
doc_link_id:
|
||||||
|
custom_name: docLinkId
|
||||||
|
updated_at:
|
||||||
|
custom_name: updatedAt
|
||||||
|
custom_column_names:
|
||||||
|
created_at: createdAt
|
||||||
|
doc_link_id: docLinkId
|
||||||
|
updated_at: updatedAt
|
||||||
|
custom_root_fields: {}
|
||||||
|
object_relationships:
|
||||||
|
- name: docLink
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on: doc_link_id
|
||||||
|
select_permissions:
|
||||||
|
- permission:
|
||||||
|
allow_aggregations: true
|
||||||
|
columns:
|
||||||
|
- email
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- doc_link_id
|
||||||
|
- id
|
||||||
|
filter:
|
||||||
|
docLink:
|
||||||
|
doc:
|
||||||
|
user_id:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
role: user
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
table:
|
||||||
|
name: docs
|
||||||
|
schema: public
|
||||||
|
configuration:
|
||||||
|
column_config:
|
||||||
|
created_at:
|
||||||
|
custom_name: createdAt
|
||||||
|
file_id:
|
||||||
|
custom_name: fileId
|
||||||
|
updated_at:
|
||||||
|
custom_name: updatedAt
|
||||||
|
user_id:
|
||||||
|
custom_name: userId
|
||||||
|
custom_column_names:
|
||||||
|
created_at: createdAt
|
||||||
|
file_id: fileId
|
||||||
|
updated_at: updatedAt
|
||||||
|
user_id: userId
|
||||||
|
custom_root_fields:
|
||||||
|
delete: deleteDocs
|
||||||
|
delete_by_pk: DeleteDoc
|
||||||
|
insert: insertDocs
|
||||||
|
insert_one: insertDoc
|
||||||
|
select: docs
|
||||||
|
select_aggregate: docsAggregate
|
||||||
|
select_by_pk: doc
|
||||||
|
update: updateDocs
|
||||||
|
update_by_pk: updateDoc
|
||||||
|
object_relationships:
|
||||||
|
- name: file
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on: file_id
|
||||||
|
- name: user
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on: user_id
|
||||||
|
array_relationships:
|
||||||
|
- name: docLinks
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on:
|
||||||
|
column: doc_id
|
||||||
|
table:
|
||||||
|
name: doc_links
|
||||||
|
schema: public
|
||||||
|
insert_permissions:
|
||||||
|
- permission:
|
||||||
|
check: {}
|
||||||
|
columns:
|
||||||
|
- file_id
|
||||||
|
- name
|
||||||
|
set:
|
||||||
|
user_id: x-hasura-user-id
|
||||||
|
role: user
|
||||||
|
select_permissions:
|
||||||
|
- permission:
|
||||||
|
columns:
|
||||||
|
- file_id
|
||||||
|
- id
|
||||||
|
filter: {}
|
||||||
|
limit: 0
|
||||||
|
role: public
|
||||||
|
- permission:
|
||||||
|
columns:
|
||||||
|
- name
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- file_id
|
||||||
|
- id
|
||||||
|
- user_id
|
||||||
|
filter:
|
||||||
|
user_id:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
role: user
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
table:
|
||||||
|
name: buckets
|
||||||
|
schema: storage
|
||||||
|
configuration:
|
||||||
|
column_config:
|
||||||
|
cache_control:
|
||||||
|
custom_name: cacheControl
|
||||||
|
created_at:
|
||||||
|
custom_name: createdAt
|
||||||
|
download_expiration:
|
||||||
|
custom_name: downloadExpiration
|
||||||
|
max_upload_file_size:
|
||||||
|
custom_name: maxUploadFileSize
|
||||||
|
min_upload_file_size:
|
||||||
|
custom_name: minUploadFileSize
|
||||||
|
presigned_urls_enabled:
|
||||||
|
custom_name: presignedUrlsEnabled
|
||||||
|
updated_at:
|
||||||
|
custom_name: updatedAt
|
||||||
|
custom_column_names:
|
||||||
|
cache_control: cacheControl
|
||||||
|
created_at: createdAt
|
||||||
|
download_expiration: downloadExpiration
|
||||||
|
max_upload_file_size: maxUploadFileSize
|
||||||
|
min_upload_file_size: minUploadFileSize
|
||||||
|
presigned_urls_enabled: presignedUrlsEnabled
|
||||||
|
updated_at: updatedAt
|
||||||
|
custom_name: buckets
|
||||||
|
custom_root_fields:
|
||||||
|
delete: deleteBuckets
|
||||||
|
delete_by_pk: deleteBucket
|
||||||
|
insert: insertBuckets
|
||||||
|
insert_one: insertBucket
|
||||||
|
select: buckets
|
||||||
|
select_aggregate: bucketsAggregate
|
||||||
|
select_by_pk: bucket
|
||||||
|
update: updateBuckets
|
||||||
|
update_by_pk: updateBucket
|
||||||
|
array_relationships:
|
||||||
|
- name: files
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on:
|
||||||
|
column: bucket_id
|
||||||
|
table:
|
||||||
|
name: files
|
||||||
|
schema: storage
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
table:
|
||||||
|
name: files
|
||||||
|
schema: storage
|
||||||
|
configuration:
|
||||||
|
column_config:
|
||||||
|
bucket_id:
|
||||||
|
custom_name: bucketId
|
||||||
|
created_at:
|
||||||
|
custom_name: createdAt
|
||||||
|
etag:
|
||||||
|
custom_name: etag
|
||||||
|
is_uploaded:
|
||||||
|
custom_name: isUploaded
|
||||||
|
mime_type:
|
||||||
|
custom_name: mimeType
|
||||||
|
size:
|
||||||
|
custom_name: size
|
||||||
|
updated_at:
|
||||||
|
custom_name: updatedAt
|
||||||
|
uploaded_by_user_id:
|
||||||
|
custom_name: uploadedByUserId
|
||||||
|
custom_column_names:
|
||||||
|
bucket_id: bucketId
|
||||||
|
created_at: createdAt
|
||||||
|
etag: etag
|
||||||
|
is_uploaded: isUploaded
|
||||||
|
mime_type: mimeType
|
||||||
|
size: size
|
||||||
|
updated_at: updatedAt
|
||||||
|
uploaded_by_user_id: uploadedByUserId
|
||||||
|
custom_name: files
|
||||||
|
custom_root_fields:
|
||||||
|
delete: deleteFiles
|
||||||
|
delete_by_pk: deleteFile
|
||||||
|
insert: insertFiles
|
||||||
|
insert_one: insertFile
|
||||||
|
select: files
|
||||||
|
select_aggregate: filesAggregate
|
||||||
|
select_by_pk: file
|
||||||
|
update: updateFiles
|
||||||
|
update_by_pk: updateFile
|
||||||
|
object_relationships:
|
||||||
|
- name: bucket
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on: bucket_id
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
- "!include auth_provider_requests.yaml"
|
||||||
|
- "!include auth_providers.yaml"
|
||||||
|
- "!include auth_refresh_tokens.yaml"
|
||||||
|
- "!include auth_roles.yaml"
|
||||||
|
- "!include auth_user_providers.yaml"
|
||||||
|
- "!include auth_user_roles.yaml"
|
||||||
|
- "!include auth_users.yaml"
|
||||||
|
- "!include public_customers.yaml"
|
||||||
|
- "!include storage_buckets.yaml"
|
||||||
|
- "!include storage_files.yaml"
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
[]
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
[]
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
[]
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
version: 3
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
DROP TABLE "public"."customers";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
CREATE TABLE "public"."customers" ("id" serial NOT NULL, "created_at" timestamptz NOT NULL DEFAULT now(), "name" text NOT NULL, PRIMARY KEY ("id") );
|
||||||
49
examples/codegen-react-apollo/package.json
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
{
|
||||||
|
"name": "@nhost-examples/codegen-react-apollo",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@apollo/client": "^3.6.9",
|
||||||
|
"@nhost/react": "*",
|
||||||
|
"@nhost/react-apollo": "*",
|
||||||
|
"graphql": "^16.5.0",
|
||||||
|
"react": "^18.2.0",
|
||||||
|
"react-dom": "^18.2.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"codegen": "graphql-codegen --config graphql.config.yaml --errors-only",
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"preview": "vite preview --host localhost --port 3000"
|
||||||
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"extends": [
|
||||||
|
"react-app",
|
||||||
|
"react-app/jest"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"browserslist": {
|
||||||
|
"production": [
|
||||||
|
">0.2%",
|
||||||
|
"not dead",
|
||||||
|
"not op_mini all"
|
||||||
|
],
|
||||||
|
"development": [
|
||||||
|
"last 1 chrome version",
|
||||||
|
"last 1 firefox version",
|
||||||
|
"last 1 safari version"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@graphql-codegen/cli": "^2.6.2",
|
||||||
|
"@graphql-codegen/typescript-operations": "^2.4.2",
|
||||||
|
"@graphql-codegen/typescript-react-apollo": "^3.2.16",
|
||||||
|
"@types/node": "^16.7.13",
|
||||||
|
"@types/react": "^18.0.0",
|
||||||
|
"@types/react-dom": "^18.0.0",
|
||||||
|
"eslint": "^8.0.0",
|
||||||
|
"eslint-config-react-app": "^7.0.1",
|
||||||
|
"typescript": "^4.4.2",
|
||||||
|
"vite": "^2.9.7"
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
examples/codegen-react-apollo/public/favicon.ico
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
examples/codegen-react-apollo/public/logo192.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
examples/codegen-react-apollo/public/logo512.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
25
examples/codegen-react-apollo/public/manifest.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"short_name": "React App",
|
||||||
|
"name": "Create React App Sample",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "favicon.ico",
|
||||||
|
"sizes": "64x64 32x32 24x24 16x16",
|
||||||
|
"type": "image/x-icon"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "logo192.png",
|
||||||
|
"type": "image/png",
|
||||||
|
"sizes": "192x192"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "logo512.png",
|
||||||
|
"type": "image/png",
|
||||||
|
"sizes": "512x512"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start_url": ".",
|
||||||
|
"display": "standalone",
|
||||||
|
"theme_color": "#000000",
|
||||||
|
"background_color": "#ffffff"
|
||||||
|
}
|
||||||
3
examples/codegen-react-apollo/public/robots.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# https://www.robotstxt.org/robotstxt.html
|
||||||
|
User-agent: *
|
||||||
|
Disallow:
|
||||||
25
examples/codegen-react-apollo/src/App.tsx
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import { NewCustomer } from './components/new-customer'
|
||||||
|
import { Customers } from './components/customers'
|
||||||
|
import { NhostApolloProvider } from '@nhost/react-apollo'
|
||||||
|
import { nhost } from './utils/nhost'
|
||||||
|
import { NhostReactProvider } from '@nhost/react'
|
||||||
|
|
||||||
|
function App() {
|
||||||
|
return (
|
||||||
|
<NhostReactProvider nhost={nhost}>
|
||||||
|
<NhostApolloProvider nhost={nhost}>
|
||||||
|
<div>
|
||||||
|
<h1>GraphQL Code Generator example with React and Apollo</h1>
|
||||||
|
<div>
|
||||||
|
<NewCustomer />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Customers />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</NhostApolloProvider>
|
||||||
|
</NhostReactProvider>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default App
|
||||||
26
examples/codegen-react-apollo/src/components/customers.tsx
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import { useGetCustomersQuery } from '../utils/__generated__/graphql'
|
||||||
|
|
||||||
|
export function Customers() {
|
||||||
|
const { data, loading, error } = useGetCustomersQuery()
|
||||||
|
|
||||||
|
if (loading || !data) {
|
||||||
|
return <div>Loading</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return <div>Error</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
const { customers } = data
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<h2>Customers</h2>
|
||||||
|
<ul>
|
||||||
|
{customers.map((customer) => (
|
||||||
|
<li key={customer.id}>{customer.name}</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||