Gamespark Framework documentation:
- GSF Authentication: receive server response and send request, then dispatch all event to the dispatcher
- Ui Authentication: listen to all event related from dispatcher. Send Ui input from the authentication panel as event
UiAuthentication.cs can be deleted. The framework does not share dependencies. feel free to not use it / duplicate / modify it for your purpose.
Available Authentication modes:
Before starting you need to enable authentication options on the portal.
Device – also known as the “guest” mode it will use the device id. note that some update of IOS will change the way device id is used, making it impossible for the user to use his previous account. This mode is usually made for quick access to the game without friction but later user should be prompted to update his account.
Login & Register – This mode is the traditional login system. Credential can be cached by setting option in editor.
Wechat – Tested on mobile device, it will require some complex paperwork to get it working because of Chinese administration restriction.
Facebook – Tested on all platforms, based upon the Facebook integration tutorial
GameCenter – Only on IOS. it require the user to be previously logged in his GameCenter account.
How to add more modes?
Locate within GsfAuthentication.cs
protected override void OnAuthenticated (EventData.AuthenticatedEvent result)
_statusField.text = "Logged in: " + result.UsedAuthentication;
var isDeviceLogin = result.UsedAuthentication == EventData.AuthenticatedEvent.AuthType.DeviceLogin;
_statusField.text = "Logged in using Device ID";
if (result.UsedAuthentication == EventData.AuthenticatedEvent.AuthType.Login)
_statusField.text = "Logged in as: " + DataManager.Instance.Get_string (Keys.UserName);
if (result.UsedAuthentication == EventData.AuthenticatedEvent.AuthType.Facebook)
EventManager.SendEvent(new EventData.UpdateAuthStatus("Gamespark using Facebook"));
if (result.UsedAuthentication == EventData.AuthenticatedEvent.AuthType.Wechat)
EventManager.SendEvent(new EventData.UpdateAuthStatus("Gamespark using Wechat"));
if (result.UsedAuthentication == EventData.AuthenticatedEvent.AuthType.Amazon)
EventManager.SendEvent(new EventData.UpdateAuthStatus("Gamespark using Amazon"));
if (result.UsedAuthentication == EventData.AuthenticatedEvent.AuthType.GameCenter)
EventManager.SendEvent(new EventData.UpdateAuthStatus("Gamespark using GameCenter"));
// TODO add new mode here
What other options are available ?
- Login if saved locally: set to true and your user password will be cached in player pref so they do not need to type again.
- Force Device Login: set to true and the player will be directly authenticated as a guest if no credential were cached before