Skip to content

Commit

Permalink
Merge branch 'master' into business-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
shahbaz17 authored Sep 18, 2023
2 parents 389e77d + f283b5b commit 13257bf
Show file tree
Hide file tree
Showing 433 changed files with 12,847 additions and 6,138 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/linkcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Check External links

on: push

jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
file-extension: .mdx
check-modified-files-only: "yes"
4 changes: 4 additions & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run install
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Website
# Web3Auth Documentation

This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.

Expand Down
40 changes: 23 additions & 17 deletions docs/auth-provider-setup/aggregate-verifier.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,36 @@ such verifiers are called `Single ID Verifiers`.

### Set up an Aggregate Verifier

1. Create an aggregate verifier for your application by selecting `Aggregate` as the Login provider from the login provider list of the modal.
![Login Providers list on Web3Auth Dashboard](/dashboard/verifiers/login-providers-list.png)
2. Click on `Add sub-verifier` to add a new sub-verifier.
![Add first sub-verifier on Web3Auth Dashboard](/dashboard/verifiers/aggregate-verifier/1.png)
1. Create an aggregate verifier for your application by selecting `Aggregate Multiple Providers` as the Login provider from the login providers.
![Login Providers list on Web3Auth Dashboard](/images/dashboard/create-verifier-aggregate.png)
2. Click on `Add Sub Verifiers` to add a new sub-verifier.
![Add first sub-verifier on Web3Auth Dashboard](/images/dashboard/create-verifier-aggregate-add-sub.png)
3. Select any social login provider from the list to start with. Here we're selecting `Google`. Paste the **Client ID** from the Google App to the
`Client ID` field and click on `Add`.
![Select Google from Login Providers list on Web3Auth Dashboard](/dashboard/verifiers/aggregate-verifier/2.png)
4. Next, create the second sub-verifier. Click on `Add sub-verifier` to add a new sub-verifier.
5. Select `Auth0` or `Custom` from the login provider list. We're selecting `Auth0` in this example.
![Auth0 as sub verifier on Web3Auth Dashboard](/dashboard/verifiers/aggregate-verifier/3.png)
`Client ID` field and click on `Add Sub Verifiers`.
![Select Google from Login Providers list on Web3Auth Dashboard](/images/dashboard/create-verifier-aggregate-google.png)
4. Next, create the second sub-verifier. Click on `Add Sub Verifiers` to add a new sub-verifier.
5. Select `Auth0` from the dropdown or choose `Custom Providers` from the radio buttons. We're selecting `Auth0` in this example.
![Auth0 as sub verifier on Web3Auth Dashboard](/images/dashboard/create-verifier-aggregate-add-second-sub.png)
6. Select the `Authentication Type` based on your application need from the dropdown. We're selecting `Github` in this example.
![Create Aggregate Verifiier on Web3Auth Dashboard](/dashboard/verifiers/aggregate-verifier/3.png)
![Create Aggregate Verifiier on Web3Auth Dashboard](/images/dashboard/create-verifier-aggregate-auth0-github.png)
7. Select `Email` as the **JWT Verifier ID** and enter the `Auth0 Client ID` and `Auth0 Domain` from your Auth0 application. See how to create a new
Auth0 application [here](https://auth0.com/docs/quickstart/webapp/).

![Create GitHub Sub Verifiier on Web3Auth Dashboard](/dashboard/verifiers/aggregate-verifier/4.png)
![Create GitHub Sub Verifiier on Web3Auth Dashboard](/images/dashboard/create-verifier-aggregate-auth0-github-filled.png)
![Domain and Client ID from Auth0 Dashboard](/dashboard/verifiers/aggregate-verifier/av-a0-github.png)

:::info NOTE

1. Add the [GitHub Social Connection](https://marketplace.auth0.com/integrations/github-social-connection) to your Auth0 application.
2. One has to request email from user while setting up the GitHub Social Connection on Auth0 Dashboard.
2. One has to request an email from the user while setting up the GitHub Social Connection on the Auth0 Dashboard.
![Request Email address for GitHub Social connection](/dashboard/verifiers/aggregate-verifier/av-a0-github-email.png)

:::

8. Similarly, creare a third sub verifier for `Email Passwordless` via Auth0. Follow the above step from 5 to 8, and select `Email Passwordless` in
place of `Github`. ![Create Email Passwordless Sub Verifiier on Web3Auth Dashboard](/dashboard/verifiers/aggregate-verifier/5.png)
9. Finally, click on `Create` to deploy the verifier. ![Login Providers list on Web3Auth Dashboard](/dashboard/verifiers/aggregate-verifier/6.png)
8. Similarly, create a third sub-verifier for `Email Passwordless` via Auth0. Follow the above steps from 5 to 8, and select `Email Passwordless` in
place of `Github`.
![Create Email Passwordless Sub Verifiier on Web3Auth Dashboard](/images/dashboard/create-verifier-aggregate-auth0-email-passwordless-filled.png)
9. Finally, click on `Create` to deploy the verifier.

:::note NOTE

Expand All @@ -51,7 +52,7 @@ You can aggregate two or more verifiers.

### Example

```js
```tsx
import { Web3AuthNoModal } from "@web3auth/no-modal";
import { OpenloginAdapter } from "@web3auth/openlogin-adapter";
import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider";
Expand All @@ -62,12 +63,17 @@ const clientId = "YOUR_WEB3AUTH_CLIENT_ID";
const chainConfig = {
chainNamespace: "eip155",
chainId: "0x1",
rpcTarget: "https://rpc.ankr.com/eth",
displayName: "Ethereum Mainnet",
blockExplorer: "https://goerli.etherscan.io",
ticker: "ETH",
tickerName: "Ethereum",
};

const web3auth = new Web3AuthNoModal({
clientId,
chainConfig,
web3AuthNetwork: "testnet",
web3AuthNetwork: "sapphire_mainnet",
});

const privateKeyProvider = new EthereumPrivateKeyProvider({ config: { chainConfig } });
Expand Down
8 changes: 4 additions & 4 deletions docs/auth-provider-setup/auth-provider-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import FederatedTiles from "@site/src/common/docs/_federated-providers.mdx";
import SocialTiles from "@site/src/common/docs/_social-login-providers.mdx";
import SocialViaFederatedTiles from "@site/src/common/docs/_social-via-federated-providers.mdx";

Auth Provider setup refers to the capability of creating a verifier with Web3Auth. We recommend you to use setup a verifer to use Custom
Authentication feature of Web3Auth.
Auth Provider setup refers to the capability of creating a verifier with Web3Auth. We recommend you set a verifier to use the Custom Authentication
feature of Web3Auth.

## Supported Auth Providers

Expand All @@ -31,12 +31,12 @@ Authentication feature of Web3Auth.

:::info

For a Custom JWT based authentication services you need to use the [`Web3Auth Plug and Play No Modal SDK`](/sdk/pnp/web/no-modal/), since the Web3Auth
For Custom JWT-based authentication services, you need to use the [`Web3Auth Plug and Play No Modal SDK`](/sdk/pnp/web/no-modal/), since the Web3Auth
Modal will only help you configure the social logins present within the Modal UI.

:::

<BYOCustomJWTTiles />

There are some nuances with certain login providers, so don't hesitate to get in touch with us on [Discord](https://discord.gg/web3auth) or simply
create a [GitHub Discussion](https://web3auth.io/discussions) and we will take care of things from there.
post your query on the [Community Forum](https://web3auth.io/community) and we will take care of things from there.
34 changes: 17 additions & 17 deletions docs/auth-provider-setup/byo-jwt-providers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ JWT should be exposed through an endpoint, which is used by Web3Auth to verify t

:::caution Facing issue with JWT?

Checkout [**this troubleshooting page to fix those.**](/troubleshooting/jwt-errors).
Check out [**this troubleshooting page to fix those.**](/troubleshooting/jwt-errors).

:::

## Set up Custom JWT Verifier

![Custom JWT Provider on Web3Auth Dashboard](/dashboard/verifiers/custom-jwt-verifier.png)
![Custom JWT Provider on Web3Auth Dashboard](/images/dashboard/create-verifier-custom-jwt.png)

To create a custom verifier for your JWT Providers, you'll need

Expand Down Expand Up @@ -68,7 +68,7 @@ To create a custom verifier for your JWT Providers, you'll need
- Token Audience ( `aud` ): The "aud" (audience) claim identifies the recipients for which the JWT is intended. Each principal intended to process
the JWT MUST identify itself with a value in the audience claim. If the principal processing the claim does not identify itself with a value in
the "aud" claim when this claim is present, then the JWT will be rejected. The `aud` value is a case-sensitive string containing a StringOrURI
value. The interpretation of audience values is generally application specific.
value. The interpretation of audience values is generally application-specific.

- Token Issuer ( `iss` ): The issuing authority of the token. The `iss` value is a case-sensitive string containing a StringOrURI value. Use of
this claim is OPTIONAL.
Expand All @@ -95,7 +95,7 @@ values={[

### Using RSA for JWT Signing

```js
```tsx
// Step 1. npm init -y
// Step 2. npm install jsonwebtoken
// Step 3. create an index.js file and paste the below code
Expand Down Expand Up @@ -140,7 +140,7 @@ console.log(token);

### Using ECDSA for JWT Signing

```js
```tsx
// Step 1. npm init -y
// Step 2. npm install jsonwebtoken
// Step 3. create an index.js file and paste the below code
Expand Down Expand Up @@ -184,11 +184,11 @@ console.log(token);

</Tabs>

See [this](#filled-custom-jwt-verifier) to setup the custom jwt verifier using the above JWT data on Web3Auth Dashboard.
See [this](#filled-custom-jwt-verifier) to set up the custom jwt verifier using the above JWT data on the Web3Auth Dashboard.

### Login with JWT (idToken - jsonwebtoken)

```js
```tsx
const chainConfig = {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: "0x1",
Expand All @@ -201,7 +201,7 @@ const chainConfig = {
const web3auth = new Web3AuthNoModal({
clientId: "", // Web3Auth Client ID
chainConfig,
web3AuthNetwork: "cyan", // testnet, mainnet, cyan, aqua
web3AuthNetwork: "saphhire_mainnet",
useCoreKitKey: false,
});

Expand Down Expand Up @@ -232,7 +232,7 @@ await web3auth.connectTo(WALLET_ADAPTERS.OPENLOGIN, {

## Using `jose` to generate JWT

```js
```tsx
// Step 1. npm init -y && npm install jose
// Step 2. create an index.js file and paste the below code
import * as jose from "jose";
Expand Down Expand Up @@ -267,11 +267,11 @@ console.log(protectedHeader);
console.log(payload);
```

See [this](#filled-custom-jwt-verifier) to setup the custom jwt verifier using the above JWT data on Web3Auth Dashboard.
See [this](#filled-custom-jwt-verifier) to set up the custom jwt verifier using the above JWT data on the Web3Auth Dashboard.

### Login with JWT (idToken - jose)

```js title="Example"
```tsx title="Example"
const chainConfig = {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: "0x1",
Expand All @@ -284,7 +284,7 @@ const chainConfig = {
const web3auth = new Web3AuthNoModal({
clientId: "", // Web3Auth Client ID
chainConfig,
web3AuthNetwork: "cyan", // testnet, mainnet, cyan, aqua
web3AuthNetwork: "saphhire_mainnet",
useCoreKitKey: false,
});

Expand Down Expand Up @@ -320,7 +320,7 @@ await web3auth.connectTo(WALLET_ADAPTERS.OPENLOGIN, {
The `jwks-rsa` library provides a small helper that makes it easy to configure `passport-jwt` with the `RS256` algorithm. Using `passportJwtSecret`
you can generate a secret provider that will provide the right signing key to `passport-jwt` based on the `kid` in the JWT header.

```js
```tsx
// Step 1. npm init -y && npm install passport-jwt
// Step 2. create an index.js file and paste the below code
const Express = require('express');
Expand Down Expand Up @@ -355,11 +355,11 @@ passport.use(
app.use(passport.initialize());
```

See [this](#filled-custom-jwt-verifier) to setup the custom jwt verifier using the above JWT data on Web3Auth Dashboard.
See [this](#filled-custom-jwt-verifier) to set up the custom jwt verifier using the above JWT data on the Web3Auth Dashboard.

### Login with JWT (idToken - passport-jwt)

```js title="Example"
```tsx title="Example"
import { Web3AuthNoModal } from "@web3auth/no-modal";
import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider";
import { OpenloginAdapter } from "@web3auth/openlogin-adapter";
Expand All @@ -376,7 +376,7 @@ const chainConfig = {
const web3auth = new Web3AuthNoModal({
clientId: "", // Web3Auth Client ID
chainConfig,
web3AuthNetwork: "cyan", // testnet, mainnet, cyan, aqua
web3AuthNetwork: "saphhire_mainnet",
useCoreKitKey: false,
});

Expand Down Expand Up @@ -452,7 +452,7 @@ If you're using `jose` or `jsonwebtoken` library, you can use the following step
- One of the tools is https://russelldavies.github.io/jwk-creator/
- Select Public Key Use: `Signing`
- Algorithm: `RS256`
- Key ID: `676da9d312c39a429932f543e6c1b6512e4983` // Use your own alpha numeric random string here.
- Key ID: `676da9d312c39a429932f543e6c1b6512e4983` // Use your own alphanumeric random string here.
- PEM encoded key: `{paste-the-publicKey-pem-file-s-content-here}`
- Click on `Convert` button.

Expand Down
Loading

0 comments on commit 13257bf

Please sign in to comment.