Unity Passport Reference
Information includes method descriptions, parameters and return types.
Init​
Initialises Passport with the specified parameters.
This sets up the Passport instance, configures the web browser, and waits for the ready signal.
Method parameters
The user's client ID.
The environment to connect to.
The URL where the browser will redirect after successful authentication.
The URL where the browser will redirect after logout is complete.
(Windows only) Timeout duration in milliseconds to wait for the default Windows browser engine to start.
(Windows only) Custom Windows browser to use instead of the default browser in the SDK.
Returns
The initialised Passport object.
SetCallTimeout​
Sets the timeout time for waiting for each call to respond (in milliseconds).
This only applies to functions that use the browser communications manager.
Method parameters
Length of timeout in milliseconds.
Returns
Login​
Logs into Passport using Authorisation Code Flow with Proof Key for Code Exchange (PKCE).
This opens the user's default browser on desktop or an in-app browser on mobile.
If useCachedSession
is set to true
, Passport will attempt to re-authenticate the player using stored credentials. If re-authentication fails, it won't automatically prompt the user to log in again.
Method parameters
If true
, the saved access token or refresh token will be used to log the user in. If this fails, it won't automatically prompt the user to log in again.
Optional parameter to bypass the provider selection page and redirect directly to a specific authentication provider. Use DirectLoginMethod.Google
, DirectLoginMethod.Apple
, DirectLoginMethod.Facebook
, or DirectLoginMethod.None
for default behavior.
Returns
true
if login is successful. Otherwise, false
.
Logout​
Logs the gamer out of Passport and removes any stored credentials.
Method parameters
If false
, the user will not be logged out of Passport in the browser. The default is true
.
HasCredentialsSaved​
Checks if credentials exist but does not check if they're valid.
Returns
true
if there are credentials saved. Otherwise, false
.
GetAccessToken​
Gets the currently saved access token without verifying its validity.
Returns
The current access token.
GetIDToken​
Gets the currently saved ID token without verifying its validity.
Returns
The current ID token.
GetLinkedAddresses​
Gets the list of external wallets the user has linked to their Passport account via the Dashboard.
Returns
External wallet addresses linked to the user's Passport account.
GetEmail​
Retrieves the email address of the user whose credentials are currently stored.
Returns
The email address of the current user.
GetPassportId​
Retrieves the Passport ID of the user whose credentials are currently stored.
Returns
The Passport ID of the current user.
ConnectEvm​
Instantiates the zkEVM provider.
Returns
ZkEvmRequestAccounts​
Returns a list of wallet addresses owned by the user.
Returns
Wallet addresses owned by the user.
ZkEvmGetBalance​
Gets the balance of the given address in wei.
Method parameters
Address to check for balance.
Integer block number, or the string "latest", "earliest" or "pending".
Returns
The balance of the given address in wei.
ZkEvmSendTransaction​
Sends a transaction to the network and signs it using the logged-in Passport account.
Method parameters
A transaction request containing to
, data
and value
fields.
Returns
The transaction hash, or the zero hash if the transaction is not yet available.
ZkEvmSendTransactionWithConfirmation​
Sends a transaction to the network, signs it using the logged-in Passport account, and waits for the transaction to be included in a block.
Similar to ZkEvmSendTransaction
.
Method parameters
A transaction request containing to
, data
and value
fields.
Returns
The receipt of the transaction or null
if it is still processing.
ZkEvmGetTransactionReceipt​
Retrieves the transaction information of a given transaction hash using the Ethereum JSON-RPC eth_getTransactionReceipt
method.
Method parameters
The hash of the given transaction.
Returns
The receipt of the transaction or null
if it is still processing.
ZkEvmSignTypedDataV4​
Signs the EIP-712 structured message in JSON string format using the logged-in Passport account.
Method parameters
The EIP-712 structured data in JSON string format.
Returns
The signed payload string.
ClearCache​
Clears the underlying WebView resource cache. On Android, note that the cache is per-application, so this will clear the cache for all WebViews used.
Method parameters
If false
, only the RAM/in-memory cache is cleared.
Returns
ClearStorage​
Clears all the underlying WebView storage currently being used by the JavaScript storage APIs, including Web SQL Database and the HTML5 Web Storage APIs.