Skip to content

Commit

Permalink
modularized google and ssv
Browse files Browse the repository at this point in the history
  • Loading branch information
ihsraham committed Oct 16, 2023
1 parent f737791 commit 7e06953
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 47 deletions.
12 changes: 12 additions & 0 deletions src/common/guides/_creating-verifiers.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- Create a **Verifier** from the **Custom Auth** Section of the [Web3Auth Developer Dashboard](https://dashboard.web3auth.io/) with following
configuration:

- Choose a name of your choice for the verifier identifier. `eg. google-core-verifier`
- Select environment: `Sapphire Devnet` or `Sapphire Mainnet` as per your requirement.
- Select `Google` from the **Login Provider**. ![Google - Login Providers list on Web3Auth Dashboard](/images/dashboard/create-verifier.png)
- Paste the **Client ID** from the Google App(above) to the `Client ID` field.
![Google Client ID on Web3Auth Dashboard](/images/dashboard/create-verifier-google.png)
- Click on the `Create` button to create your verifier. It may take up to 10 minutes to deploy the verifier on _Sapphire Devnet_. You'll receive an
email once it's complete.

- You will require the `verifierName` of the newly created verifier and `clientId` of the Plug and Play Project.
8 changes: 8 additions & 0 deletions src/common/guides/_google-app-setup.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
1. Follow Google’s instructions to [set up an OAuth 2.0 app.](https://support.google.com/cloud/answer/6158849?hl=en)
2. Paste the following as a Redirect URI into the "Authorized redirect URIs" field.

- [https://auth.web3auth.io/auth](https://auth.web3auth.io/auth)

![Google OAuth2.0 App Dashboard](/content-hub/social-providers/google/google-app-redirect-uri.png)

3. Obtain the OAuth `Client ID` from your [App on the Google Developer dashboard](https://console.developers.google.com/)
27 changes: 6 additions & 21 deletions src/pages/content-hub/guides/google.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ order: 9
communityPortalTopicId: 54
---

import CreatingVerifiers from "@site/src/common/guides/_creating-verifiers.mdx";
import GoogleAppSetup from "@site/src/common/guides/_google-app-setup.mdx";
import InitializationIntro from "@site/src/common/guides/_initialization-intro.mdx";
import InitializationWeb3Auth from "@site/src/common/guides/_initialization-web3auth.mdx";
import Installation from "@site/src/common/guides/_installation.mdx";
Expand Down Expand Up @@ -60,31 +62,13 @@ When integrating Web3Auth with Google Login the flow looks something like this:

### Setup your Google App

1. Follow Google’s instructions to [set up an OAuth 2.0 app.](https://support.google.com/cloud/answer/6158849?hl=en)
2. Paste the following as a Redirect URI into the "Authorized redirect URIs" field.

- [https://auth.web3auth.io/auth](https://auth.web3auth.io/auth)

![Google OAuth2.0 App Dashboard](/content-hub/social-providers/google/google-app-redirect-uri.png)

3. Obtain the OAuth `Client ID` from your [App on the Google Developer dashboard](https://console.developers.google.com/)
<GoogleAppSetup />

### Setup your Web3Auth Dashboard

<SetupWeb3AuthDashboard />

- Create a **Verifier** from the **Custom Auth** Section of the [Web3Auth Developer Dashboard](https://dashboard.web3auth.io/) with following
configuration:

- Choose a name of your choice for the verifier identifier. `eg. google-core-verifier`
- Select environment: `Sapphire Devnet` or `Sapphire Mainnet` as per your requirement.
- Select `Google` from the **Login Provider**. ![Google - Login Providers list on Web3Auth Dashboard](/images/dashboard/create-verifier.png)
- Paste the **Client ID** from the Google App(above) to the `Client ID` field.
![Google Client ID on Web3Auth Dashboard](/images/dashboard/create-verifier-google.png)
- Click on the `Create` button to create your verifier. It may take up to 10 minutes to deploy the verifier on _Sapphire Devnet_. You'll receive an
email once it's complete.

- You will require the `verifierName` of the newly created verifier and `clientId` of the Plug and Play Project.
<CreatingVerifiers />

## Using the Web3Auth SDK

Expand All @@ -105,7 +89,8 @@ For this guide, we will be talking through the [Web3Auth Plug and Play No Modal
<InitializationIntro />

For this guide, we're only focusing on the Instantiation, Configuration for the Openlogin Adapter (the default adapter that enables social logins) and
Initialization of the Web3Auth SDK. To know more about the other things you can do with Web3Auth, checkout our [SDK Reference](/sdk/pnp/web/no-modal).
Initialization of the Web3Auth SDK. To know more about the other things you can do with Web3Auth, check out our
[SDK Reference](/sdk/pnp/web/no-modal).

#### Instantiating Web3Auth

Expand Down
35 changes: 9 additions & 26 deletions src/pages/content-hub/guides/server-side-verification.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ order: 9
communityPortalTopicId: 65
---

import CreatingVerifiers from "@site/src/common/guides/_creating-verifiers.mdx";
import GoogleAppSetup from "@site/src/common/guides/_google-app-setup.mdx";
import InitializationIntro from "@site/src/common/guides/_initialization-intro.mdx";
import InitializationWeb3Auth from "@site/src/common/guides/_initialization-web3auth.mdx";
import Installation from "@site/src/common/guides/_installation.mdx";
Expand Down Expand Up @@ -50,33 +52,13 @@ npx degit Web3Auth/web3auth-pnp-examples/web-no-modal-sdk/server-side-verificati

### Setup your Google App

1. Follow Google’s instructions to [set up an OAuth 2.0 app.](https://support.google.com/cloud/answer/6158849?hl=en)
2. Paste the following as Redirect URI into the "Authorized redirect URIs" field.

- https://testing.openlogin.com/auth (for Web3Auth testnet used in demo applications)

- https://app.openlogin.com/auth (for Web3Auth mainnet used in production applications)

![Google OAuth2.0 App Dashboard](/content-hub/social-providers/google/google-app-redirect-uri.png)

3. Obtain the OAuth `Client ID` from your [App on the Google Developer dashboard](https://console.developers.google.com/)
<GoogleAppSetup />

### Setup your Web3Auth Dashboard

<SetupWeb3AuthDashboard />

- Create a **Verifier** from the **Custom Auth** Section of the [Web3Auth Developer Dashboard](https://dashboard.web3auth.io/) with following
configuration:

- Choose a name of your choice for the verifier identifier. `eg. google-core-verifier-ssv`
- Select environment: `testnet`, `mainnet`, `aqua`, or `cyan` as per your requirement.
- Select `Google` from the **Login Provider**. ![Google - Login Providers list on Web3Auth Dashboard](/dashboard/verifiers/login-providers-list.png)
- Paste the **Client ID** from the Google App(above) to the `Client ID` field.
![Google Client ID on Web3Auth Dashboard](/dashboard/verifiers/google-verifier.png)
- Click on `Create` button to create your verifier. It may take up to 10 minutes to deploy verifier on _testnet_. You'll receive an email once it's
complete.

- You will require the `verifierName` of the newly created verifier and `clientId` of the Plug and Play Project.
<CreatingVerifiers />

### Setup your Next.js Project

Expand All @@ -87,7 +69,7 @@ npx degit Web3Auth/web3auth-pnp-examples/web-no-modal-sdk/server-side-verificati
To use the Web3Auth SDK, you need to add the dependency of the respective platform SDK of Web3Auth to your project. To know more about the available
SDKs, please have a look at this [documentation page](/sdk).

For this guide here, we will be talking through the [Web3Auth Plug and Play No Modal SDK](/sdk/pnp/web/no-modal) and using the
For this guide, we will be talking through the [Web3Auth Plug and Play No Modal SDK](/sdk/pnp/web/no-modal) and using the
[OpenLogin Provider](/sdk/pnp/web/adapters/openlogin) alongside it to enable Custom Authentication through Google Login.

<SetupBaseProject />
Expand All @@ -101,7 +83,8 @@ For this guide here, we will be talking through the [Web3Auth Plug and Play No M
<InitializationIntro />

For this guide, we're only focusing on the Instantiation, Configuration for the Openlogin Adapter (the default adapter that enables social logins) and
Initialization of the Web3Auth SDK. To know more about the other things you can do with Web3Auth, checkout our [SDK Reference](/sdk/pnp/web/no-modal).
Initialization of the Web3Auth SDK. To know more about the other things you can do with Web3Auth, check out our
[SDK Reference](/sdk/pnp/web/no-modal).

#### Instantiating Web3Auth

Expand Down Expand Up @@ -139,8 +122,8 @@ const user = await web3auth.getUserInfo();
console.log("User info", user);
```

Using the `getUserInfo` function, you can get the details of the logged in user. Please note that these details are not stored anywhere in Web3Auth
network, but are fetched from the id_token you received from AWS Cognito and lives in the frontend context.
Using the `getUserInfo` function, you can get the details of the loggedin user. Please note that these details are not stored anywhere in Web3Auth
network, but are fetched from the id_token you received from AWS Cognito and live in the frontend context.

### Logout

Expand Down

0 comments on commit 7e06953

Please sign in to comment.