Web Quickstart
Quickstart: Implementing Particle Auth within Web Applications
Getting started and integrating Particle Network’s Wallet-as-a-Service within your web application often takes less than five minutes.
Below is a quick rundown on installing, configuring, and facilitating social logins within a typical Next.js application. For a more in-depth explanation of each feature, go to Introduction to API & SDK overview.
Installing Particle Auth
Particle Auth is the primary mechanism of implementing Particle Network’s Wallet-as-a-Service and associated social authentication flow.
To install Particle Auth within your project, copy and execute the following command.
Configuring Particle Auth
Once installed, you’re ready to configure the SDK.
Particle Auth requires three key values to be initiated: projectId
, clientKey
, and appId
. These values fundamentally link your application with the Particle dashboard.
To retrieve these values for configuration within your application, follow these steps:
For more information on the Particle dashboard, take a look at this video or visit the dashboard quickstart.
With your projectId
, clientKey
, and appId
retrieved, you’ll need to configure Particle Auth within your application through AuthCoreContextProvider
from @particle-network/authkit
, the primary React component responsible for initializing Particle Auth.
Configuring `AuthCoreContextProvider`
The AuthCoreContextProvider
component handles the configuration for Particle Auth. It’s best practice to place this configuration in a dedicated AuthKit.tsx
file within the src
directory, where you can set up and export the component.
Once configured, you can use this export to wrap your main App
component, ensuring authentication is available throughout your application.
Here’s an example of how to configure AuthCoreContextProvider
:
Wrap your application with ParticleAuthkit
Wrap your main application component (where you use the Particle Auth hooks) with the ParticleAuthKit
component, which is exported from AuthKit
.
Here’s an example of how this might look in a layout.tsx
file:
Facilitating logins
With the SDK configured, you can move on to initiating social logins within your application. Particle Auth contains numerous relevant hooks, although we’ll specifically be focusing on useConnect
, which contains a function, connect
, that directly facilitates wallet creation through social login.
Upon logging in, the embedded wallet modal included with Particle Auth will be accessible through the button in the bottom right, unless otherwise specified through wallet
within AuthCoreContextProvider
.
For the complete Particle Auth SDK reference, head over to the
Web (JavaScript/TypeScript) documentation.
For practical examples, check out the following demo repositories:
Next.js: Particle Auth Next Starter
Create React App: Particle Auth CRA Starter
Related Resources
Was this page helpful?