Integrating with wagmi
Wagmi is a collection of React hooks for Ethereum, making it easy to interact with wallets and smart contracts. Okto provides seamless integration with Wagmi through its adapter package, allowing you to add social login options via Okto to your existing Wagmi application.
This guide shows how to add Okto wallet support to an existing wagmi application, enabling social login options for your users.
If you're starting from scratch, you have two options:
- Build with an Okto SDK directly
- Follow the wagmi getting started guide first, then return here to add Okto support
Configure Wagmi
Create a configuration file to set up wagmi with the Okto connector:
Okto Configuration Parameters
Parameter | Description | Type | Required |
---|---|---|---|
environment | Environment to use for the SDK | 'sandbox' | 'production' | Yes |
clientPrivateKey | Your client private key | string | Yes |
clientSWA | Your client SWA | string | Yes |
googleClientId | Your Google client ID | string | Yes |
Set Up Providers
Update your app's root component to include the necessary providers:
Note
Make sure to add the Google Sign-In script to your HTML head for authentication:
Usage with wagmi Hooks
Once configured, you can use wagmi hooks to offer Okto social login to your users: