Skip to content

Commit b2da868

Browse files
authored
docs: android and ios pkce and registering game docs (#17)
* docs: android and ios pkce and registering game docs * docs: add macos minimum version * docs: fix links to readme pkce section
1 parent 7c0cb38 commit b2da868

File tree

2 files changed

+70
-5
lines changed

2 files changed

+70
-5
lines changed

PassportPKCELoginFlow.png

155 KB
Loading

README.md

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,43 @@
1515
### Supported Platforms
1616

1717
- Windows 10 (64-bit)
18-
- MacOS
18+
- MacOS (Unreal Engine 5.2+: [minimum version 12.5 Monterey](https://docs.unrealengine.com/5.2/en-US/macos-development-requirements-for-unreal-engine/))
19+
- Android (minimum version 8.0)
20+
- iOS (minimum version 13.0)
1921

2022
### Supported Unreal Engine Versions
2123

2224
- Unreal Engine 5.0 and above
2325
- Unreal Engine 4.26 and above
2426

27+
## Registering your game
28+
29+
Before using Passport, you must register your application as an OAuth 2.0 **Native** client in the [Immutable Developer Hub](https://hub.immutable.com). First, you'll need to create a project and a testnet environment.
30+
Then, you can navigate to the Passport config screen and create a passport client for your created environment.
31+
When you're ready to launch your application on the mainnet, please ensure you configure a passport client under a mainnet environment. Here's how you can configure the fields while creating a client:
32+
33+
### Creating an OAuth2.0 Native client
34+
35+
#### Application Type
36+
You must register your application as an OAuth 2.0 **Native** client.
37+
38+
#### Client name
39+
The name you wish to use to identify your application.
40+
41+
#### Logout URLs
42+
Native clients don't make use of Logout URLs, you might set your own website or https://localhost:3000 as this is a required field.
43+
44+
#### Callback URLs
45+
On Android, iOS and macOS clients, you should set your application's deep link scheme (e.g. `mygame://callback`) if you wish to make use of [PKCE login](#android-and-ios-pkce-login-unreal-engine-50-only), otherwise set the same as [Logout URLs](#logout-urls).
46+
47+
[PKCE login](#android-and-ios-pkce-login-unreal-engine-50-only) is not supported on Windows clients. Hence, they do not use Callback URLs. You may set Callback URLs to be the same as [Logout URLs](#logout-urls), as it is a required field.
48+
49+
#### Web Origins URLs
50+
Optional field. The URLs that are allowed to request authorisation. This field is available when you select the Native application type.
51+
52+
See [here](/docs/x/passport/register-application) for more details.
53+
54+
2555
### Installation
2656

2757
To install the plugin download it into your project's `Plugins` folder, e.g.: `MyGame/Plugins/unreal-immutable-sdk`.
@@ -32,8 +62,6 @@ To install the plugin download it into your project's `Plugins` folder, e.g.: `M
3262
> Please update `immutable.uplugin->Plugins->WebBrowserWidget` to false and restart your UE4 editor.
3363
> For Unreal Engine 5.0 and above we use inbuilt browser.
3464
35-
36-
3765
### Setup
3866

3967
#### Blueprint
@@ -66,6 +94,42 @@ Once the gamer is connected to Passport, the SDK will store your credentials (ac
6694

6795
See this Blueprint showing how to logout from passport ![Passport Logout Blueprint](PassportLogoutFlow.jpg)
6896

97+
### Android and iOS PKCE login (Unreal Engine 5.0+ only)
98+
99+
For Android and iOS, you can use the [Authorization Code Flow with Proof Key for Code Exchange (PKCE)](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-proof-key-for-code-exchange-pkce) login flow instead of [Device Code Authorisation](https://auth0.com/docs/get-started/authentication-and-authorization-flow/device-authorization-flow#:~:text=Your%20Auth0%20Authorization%20Server%20redirects,authorized%20to%20access%20the%20API.). This means the gamer has one less step to complete and will be redirected back to the game after successfully authenticating.
100+
101+
To use this flow you will need to:
102+
103+
1. Define a deep link scheme for your game (e.g. `mygame://callback`)
104+
2. Login to the [Immutable Developer Hub](https://hub.immutable.com/) and add the deeplink to your clients **Callback URLs** and **Logout URLs**
105+
3. Set this deep link as your redirect URI in `Initialize Passport`
106+
107+
![Passport PKCE Login Blueprint](PassportPKCELoginFlow.png)
108+
109+
#### Unreal Editor Android setup
110+
111+
1. In Unreal Editor go to **Project Settings** -> **Android** -> **Advanced APK Packaging**
112+
2. Add the following code inside the **Extra Settings for \<activity> section (\n to separate lines)** field:
113+
114+
```XML
115+
<intent-filter>\n<action android:name="android.intent.action.VIEW" />\n<category android:name="android.intent.category.DEFAULT" />\n<category android:name="android.intent.category.BROWSABLE" />\n<data android:host="callback" android:scheme="mygame" />\n</intent-filter>
116+
```
117+
118+
The application will now open when the device processes any link that starts with `mygame://callback`.
119+
120+
#### Unreal Editor iOS setup
121+
122+
1. In Unreal Editor go to **Project Settings** -> **iOS** -> **Extra PList Data**
123+
2. Add the following code inside the **Additional Plist Data** field:
124+
125+
```
126+
<key>CFBundleURLTypes</key><array><dict><key>CFBundleURLSchemes</key><array><string>mygame</string></array></dict></array>
127+
```
128+
129+
After this set-up and the redirect URI you set in `Initialize Passport`, your game can log in using `mygame://callback`.
130+
131+
See the [sample game](https://github.com/immutable/sample-unreal-game) for an example of how to set up PKCE for Android and iOS.
132+
69133
## Supported Functionality
70134

71135

@@ -74,8 +138,9 @@ See this Blueprint showing how to logout from passport ![Passport Logout Bluepri
74138
| GetAddress | Gets Wallet Address |
75139
| GetEmail | Get Email Address associated with the Wallet Address |
76140
| CheckStoredCredentials | Checks if there are stored credits from previous login |
77-
| Connect | New login connection |
141+
| Connect | Log into Passport using [Device Code Authorisation](https://auth0.com/docs/get-started/authentication-and-authorization-flow/device-authorization-flow#:~:text=Your%20Auth0%20Authorization%20Server%20redirects,authorized%20to%20access%20the%20API.) |
78142
| ConnectSilent | Attempts to login using stored credentials |
143+
| ConnectPKCE | (Android and iOS on Unreal Engine 5.0+ only) Log into Passport using [Authorization Code Flow with Proof Key for Code Exchange (PKCE)](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-proof-key-for-code-exchange-pkce) |
79144

80145

81146
See the [ImmutablePassport.h](https://github.com/immutable/unreal-immutable-sdk/blob/dc39324db204f2ba30e9c9f0ca25c070987785cb/Source/Immutable/Public/Immutable/ImmutablePassport.h#L115C8-L115C8) header for the full API.
@@ -217,4 +282,4 @@ You can also apply for marketing support for your project. Or, if you need help
217282

218283
## License
219284

220-
Immutable Unity SDK repository is distributed under the terms of the [Apache License (Version 2.0)](LICENSE).
285+
Immutable Unity SDK repository is distributed under the terms of the [Apache License (Version 2.0)](LICENSE).

0 commit comments

Comments
 (0)