Installing Particle Auth
particle_auth_core
, to your Flutter application; this is a requirement before moving onto platform-specific configuration.This can be done through the following command.Configuring Particle Auth
Access the Particle Dashboard
Create a new project or enter an existing project
Create a new iOS/Android application, or skip this step if you already have one
Retrieve the project ID, client key, and application ID
build.gradle
file, often found at the following file path: ${project name}/android/app/build.gradle
.Within your build.gradle
file, you’ll need to add four new lines to ensure Particle Auth runs appropriately:minSdkVersion
, which in most cases will be set to 23
.manifestPlaceholders["PN_PROJECT_ID"]
, the projectId
previously retrieved from the Particle dashboard.manifestPlaceholders["PN_PROJECT_CLIENT_KEY"]
, the clientKey
previously retrieved from the Particle dashboard.manifestPlaceholders["PN_APP_ID"]
, the appId
previously retrieved from the Particle dashboard.build.gradle
file, you’ll need to ensure that you’re using version 17 of Java in both compileOptions
and kotlinOptions
, alongside enabling dataBinding
, as shown below.build.gradle
you’ll need to ensure that the repositories
object in both buildscript
and allprojects
has maven { setUrl("https://jitpack.io") }
present, such as is shown in the following snippet.apps/{project name}.xcworkspace
.Configure ParticleNetwork-Info.plist
ParticleNetwork-Info.plist
. Ensure this is marked under Target Membership
.Now, with a fresh ParticleNetwork-Info.plist
file, go ahead and fill it in with the following values, previously retrieved from the Particle dashboard:Configuring Info.plist: Face ID
Info.plist
file by including the following code:Configuring your Podfile
particle_auth_core
is properly imported. Head over to the linked example to complete this, if you haven’t already.Another important note before continuing.
Our SDK is a static library (XCFramework). When using the Particle Auth Flutter SDK, you’ll need to specify that you’re using a static framework through the snippet below.
Initializing Particle Auth
ParticleInfo.set
. An example of this has been included in the snippet below.Upon setting these values, you’ll need to call the init
method on ParticleBase
. This takes the following parameters:chainInfo
, representing the primary chain you intend to use (for example, ChainInfo.Ethereum
, chainInfo.Polygon
).env
, affecting the information logged within your environment (Env.dev
, Env.production
, or Env.staging
).Facilitating social login
ParticleAuthCore.connect
to initiate social login, passing in the specific login type you’d like the user to onboard through (.google
, .twitter
, .discord
, etc.) alongside, if applicable, the type of account prompt used by the OAuth provider (.select_account
, .consent
, .none
).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 ParticleAuthCore.switchChain
to switch chains, and after waiting for 2 seconds, a new address for the selected chain will be generated for you.Evm.getAddress
and ParticleAuthCore.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.
EvmService.createTransaction
using standard parameters such as evmAddress
, data
, value
, and receiverAddress
,
Upon construction, the transaction can be sent through Evm.sendTransaction
; once the user signs/confirms, it’ll be pushed to the network; an example of this is shown below.