Unity + Internet Identity deep links
Overview
This sample shows one way to integrate Internet Identity with native mobile apps. It contains two parts: a dapp with II integrated, and an Unity Project which interacts with this dapp.
ii_integration_dapp
is an example that integrates with Internet Identity, with the backend and frontend. It derives from the Internet Identity integration sample demo with some modifications.
Please refer to README for details.
unity_project
is a Unity project with ICP.NET embedded, which is a C# agent that is able to communicate with the IC from C#. Please refer to README for details.
Workflow
Here is the basic workflow that how to integrate with Internet Identity from a Unity mobile game. The basic idea is to open the Web Browser from the game, login in with II in the browser, and pass the DelegationChain
back to the game.
The steps in detail are described below:
Set up an Internet Identity integration dapp which supports logging in with II.
Please refer to ii_integration_dapp to set up the dapp.Run a Unity game on Android/iOS, which is built from a unity sample.
Please refer to unity_project to build the Unity game.Launch the Web Browser from the game to open the dapp frontend deployed in #1, with the public key of
Ed25519Identity
as a parameter.Login with your Internet Identity in the Web Browser.
Launch the application via DeepLink, and pass the
DelegationChain
back to the game as the URL parameter.Composite the
DelegationIdentity
withDelegationChain
and theEd25519Identity
.Call the backend canister with the
DelegationIdentity
to greet.
Attention
Please keep in mind that DeepLink is not safe as AppLinks on Android, please read this document for details. Overall, Android App Links offer better user experience, along with better security. Please refer to the unity_ii_applink sample for more information.