Skip to main content
Version: v2

Login

danger

Deprecation Notice: Device Code Authentication

Important Dates:

  • Announcement Date: April 2025
  • Sunset Date: 1 July 2025

Affected Components:

  • Device Code Authentication flow in Unity SDK
  • All platforms: Windows, macOS, Android, iOS

Impact: Device Code Authentication will be phased out and replaced by PKCE authentication. We recommend developers begin migrating to PKCE authentication where supported to ensure a smooth transition.

📋Prerequisites

Log into Passport

⚠️Warning

The player will not have a wallet until the ZkEvmRequestAccounts function is called. Developers should call this function if they want to create a wallet for the player after logging into Passport.

For more details on authenticating users without a wallet, see the Authenticating users without wallet section.

To log the gamer into Passport:

await passport.LoginPKCE();

This opens a pop-up window on macOS or an in-app browser on mobile devices, guiding gamers through the auth flow.

Stored Credentials

Once the gamer is connected to Passport, the SDK will store your credentials (access, ID, and refresh tokens).

You may use Login(useCachedSession: true) to re-login the gamer to Passport using the saved credentials. However, if this fails, it will not automatically prompt the user to re-login again.

bool hasCredsSaved = await passport.HasCredentialsSaved();
if (hasCredsSaved)
{
await passport.Login(useCachedSession: true);
// Successfully re-logged into Passport
}