OpenAuth Widget
Aarc widget to use the OpenAuth Kit
The OpenAuth Widget by Aarc provides a seamless authentication solution for web applications, enabling secure and straightforward integration with various social and traditional auth methods. This widget is designed to support developers by simplifying the user authentication process using both Web3 and conventional authentication methods.
Installation
To install the OpenAuth widget, open your terminal and run the following command:
Configuring the widget
The configuration object allows you to customize the behavior and appearance of the authentication widget according to your needs.
Config Object
This object defines the visual aspects of the widget, the authentication methods available, and the callbacks for various events. Adjusting these settings lets developers tailor the authentication experience to the specific needs of their application.
Example Configuration
This snippet sets up the widget with a custom logo, theme color, and specifies the methods through which users can authenticate. Callback functions are provided to handle various events such as successful login or errors during the authentication process.
Integrating the Provider
Here’s how you integrate the widget into your application using the 'Provider' component:
Provider Setup
Make sure you import the style.css for the widget UI to render properly
For NextJS: Since the Aarc auth widget is meant to be used on the client side please make sure the code is running on the client side, by specifying 'use client' at the top of the file
The 'Provider' component wraps around your main app component, making the authentication functionality accessible throughout your application. This setup is essential for maintaining a consistent authentication state.
<Provider config={config}> : This component is used to pass down the authentication configuration to all components within your application. It uses React context internally to provide the configured auth methods and handlers.
config: This should be an object that contains all the necessary configuration for the authentication widget to function. This includes visual appearance settings, callback functions, authentication methods, etc., as described in your earlier documentation section.
Using the widget
The following component must be wrapped by the provider mentioned above
Send-Transaction Functionality
Implement the 'sendTransaction' function using the 'useWallet' hook to enable blockchain transactions:
To get your API Key, visit Aarc dashboard and follow the steps mentioned here.
Troubleshooting
Widget not loading: Ensure all script dependencies are loaded and the DOM is fully mounted.
Callback not firing: Check the correctness of the callback definitions in your config object.
Support
If you face any trouble, feel free to reach out to our engineers in the Telegram support group.
Last updated