Set up Google Authentication
Set up your Google App
- Follow the instructions provided by Google to configure an OAuth 2.0 application (opens in a new tab).
- Create a new project or select an existing project.
- Add your redirect URIs in the fields labelled “Authorized JavaScript origins” and “Authorized redirect URIs” (e.g.: http://localhost:3000 (opens in a new tab)).
- Obtain the OAuth Client ID and Client secret from your app on the Google Developer dashboard.
Set up your Kaiju Developer Portal
- Sign in to the Kaiju Developer Portal (opens in a new tab).
- After successfully logging in create a new project.
-
Fill out the fields and click the "Create Project" button.
-
Navigate to the 'Settings' tab in the sidebar and obtain the Access Key.
- Click on the “Custom Authentication” tab at the top, then click the “New Verifier” button to set up a new custom verifier.
- Enter the desired name for the “Verifier identifier” (e.g.: google-verifier).
- Choose "Social login providers" as the login provider.
- Select "Google" as the login provider.
- Paste the Client ID obtained from the Google App (above) into the Client ID field.
- Click the "Create verifier" button to obtain the verifier ID.
Setup the project
-
Open the terminal and clone the repository at,
https://github.com/kaiju-web3-labs/kaiju-wallet-integration-samples (opens in a new tab) -
Navigate to project “google-login”.
cd google-login\next-js
-
Install node_modules.
yarn install
-
Update the .env file.
-
Navigate to the .env file in the project folder and replace the obtained client ID, Client secret, access key and verifier ID as follows:
Run the project
-
Run the project.
yarn dev
-
Login with Google, and you will navigate to the home page. You can see your wallet details and can do a transaction from there.
At login, the application receives the user ID Token (User Token) and passes it to the getWallet and signTransaction APIs. This ID Token must include the email as a claim.
Also check the Login Flow , Transaction Flow and Go to Live .