Quickstart: Implementing Particle Auth within iOS Applications
Particle Auth, the core SDK responsible for driving social logins, has various iOS SDKs; implementation only takes a few steps. This document will go through the step-by-step process of configuring, initializing, and using Particle Auth on iOS.For complete documentation covering the implementation of Particle Auth on iOS in more depth, head over to the iOS SDK reference.
Prerequisites
- Xcode 15.0 or higher.
- CocoaPods 1.14.3 or higher.
- iOS 14 or higher.
1
Installing Particle Auth
To begin, you’ll need to install Particle Auth through your Podfile; specifically, you’ll need (at a minimum) the following libraries:
ParticleAuthCore
ParticleMPCCore
Thresh
- Optionally,
ParticleWalletAPI
for transaction construction. - Optionally,
ParticleWallerGUI
to enable an embedded wallet interface.
Podfile
2
Configuring Particle Auth
Once installed, you’re ready to configure Particle Auth and initialize the SDK.To do this, you’ll need three key values from the Particle dashboard: your project ID, client key, and app ID. These are used to authenticate your instance of Particle Auth and connect your project to the dashboard; these are required to properly initialize the SDK.To retrieve these keys, follow the steps outlined below:





For more information on the Particle dashboard, take a look at the dashboard quickstart.With your project ID, client key, and app ID retrieved, you’ll need to add a file named
Access the Particle Dashboard
Access the Particle Dashboard
Sign up or Log in into the Particle dashboard



Create a new project or enter an existing project
Create a new project or enter an existing project


Create a new iOS application, or skip this step if you already have one
Create a new iOS application, or skip this step if you already have one
Retrieve the project ID, client key, and application ID
Retrieve the project ID, client key, and application ID


ParticleNetwork-Info.plist
to your project, then insert the aforementioned keys as is exemplified below.ParticleNetwork-Info.plist
3
Initialize Particle Auth
At this point, you’ve installed and configured Particle Auth; the only step remaining before the SDK can be used is initialization.Particle Auth can be initialized by simply calling the
initialize
method on ParticleNetwork
. This takes the following parameters:config
, which takes:chainInfo
, representing the primary chain you intend to use (for example,.ethereum
,.polygon
).devEnv
, affecting the information logged within your environment (.debug
,.production
, or.staging
).
4
Facilitating social login
You’re ready to facilitate social login and interacting with the resulting accounts.As shown below, you’ll need to call
auth.connect
to initiate social login, passing in the specific login type you’d like the user to use (.google
, .twitter
, .discord
, etc.) alongside, if applicable, the type of account prompt used by the OAuth provider (.selectAccount
, .consent
, .none
).When a user logs in for the first time, if there is no account, we will create one. Based on the current chainInfo, a new address will be generated. For example, if the current chain is EVM-compatible, only an EVM address will be generated; if it’s the Solana chain, only a Solana address will be generated. If you want to obtain both addresses, you can use
auth.switchChain
to switch chains, and after waiting for 2 seconds, a new address for the selected chain will be generated for you.Examples of Utilization
Retrieve User Information
With a user logged in, you’ll be able to retrieve information about their account (such as their address, or specific details regarding the social login mechanism they used) through methods such asauth.evm.getAddress
and auth.getUserInfo
(getUserInfo
returns an object with numerous points of information; to learn more, head over to its API reference).
The following snippet is an example of retrieving a user’s address on both EVM and Solana alongside pulling their broader account information.
Send a Transaction
Now, as a final example, you can send a transaction, such as burning 0.000000001 ETH. To do this, you’ll need to construct a transaction withParticleWalletAPI.createTransaction
using standard parameters such as from
, to
, value
, and (optionally) data
.
Upon construction, the transaction can be sent through auth.evm.sendTransaction
; once the user signs/confirms, it’ll be pushed to the network; an example of this is shown below.
Open Wallet
If you includedParticleWalletGUI
within your Podfile, you can open the (optional) embedded wallet interface at any time after a user connects, use ParticleWalletGUI.setSupportChain
to set supported chains, then PNRouter
to open the interface.
Take a look at the complete demo project here.