Get Encrypted Ticket (GetEncodeUrl)
[Player Network SDK & MSDK] Acquires encrypted ticket.Encrypts the specified URL, adds login status information, and returns the encrypted URL.This is a synchronous interface, no need to obtain the result in the callback.
Supported Platforms
- Unity
- Unreal Engine
Android, iOS, Windows platform.Android, iOS, Windows platform.MSDK does not support Windows at this time.
Use Case
GetEncryptUrl is mainly used to open the marketing event webpage and pass the login status to the webpage. The game calls the interface and enters the original URL, which returns an encrypted URL with login status. Users open web pages through the interface of the OpenUrl web view module. The URL for additional parameters (encodeparam) is sent to the backend API to obtain login status information.
The GetEncryptUrl interface requires login before it can return gameid and channelid information.
Example of an encoded URL:
https://www.youtube.com/?gameid=11&os=1&ts=1597840414&version=0.1.000.0001&seq=11-42e0e9d2-2f0e-4b01-a1ab-6831cf9b6165-1597840414-11&encodeparam=4060E2A762B31B8B57A8D5A9BBAF10E8657A5A3A285B0DA7159417C2D6F0D801
Function Definition
- Unity
- Unreal Engine
string GetEncodeUrl(string url);
static std::string GetEncodeUrl(const std::string &url);
Input Parameters
- Unity
- Unreal Engine
| Parameters | Type | Description |
|---|---|---|
| url | string | Link address |
| Parameters | Type | Description |
|---|---|---|
| Url | FString | Link address |
Composition of URL parameters
Encrypted field (encodeparam):
| Parameters | Type | Description |
|---|---|---|
| openid | string | Account openid |
| token | string | Account token |
| uid | string | Third-party channel openid |
Non-encrypted fields:
| Parameters | Type | Description |
|---|---|---|
| OS | string | Client operating system 1 : Android 2: iOS 3: Web 4: Linux 5: Windows 6: Switch |
| gameid | string | ID assigned to the game by the SDK |
| channelid | int | Login channel |
| sdk_version | string | SDK version |
| user_name | string | User Name |
| ts | string | Timestamp |
| seq | string | Sequence number |
The above fields do not need to be passed; they can be obtained after Player Network SDK login.
Callback Handling
The callback handling interface is GUAWebViewResultObserver.The callback data structure is GUAWebViewRet.
- Unity
- Unreal Engine
The callback event is WebViewRetEvents. Callback ID is GUA_WEBVIEW_GET_ENCRYPT_URL.
The callback event is OnWebViewOptNotify. The callback ID is kMethodIDWebviewGetEncodeUrl.
Code Example
- Unity
- Unreal Engine
string url = UnionAdapterAPI.GetWebViewService().GetEncodeUrl("http://www.facebook.com");
FString url = GUA_NAMESPACE::GUAWebViewService::GetEncodeUrl("http://www.facebook.com");