Use FirebaseAuth as a Authentication and User Management backend for MMORPGKIT for Unity
- Provides a fast and scalable full user-management and authentication backend (with a web UI) thanks to Firebase
- Email-based registration and login
- Email verification
- Disable/Ban user
- Conditional login check to disallow banned or unverified (email) accounts
- Additional host of information like registration date, last password update time, last login time, displayName, etc.
- Asynchronous API calls
- Uses Firebase REST APIs and REST Client for Unity, so cross-platform compatible including webgl and mobile
- Supports MySQL and SQLite database backends
- ServerSide Logic (all API calls are done server-side)
- Uses Partial Classes, no changes done to MMORPGKIT core files
The below flow(s) works linearly as long as each step reports success, if any step reports error or false, that step reverts back to client with the error message and displays it to the client.
During registration and login, the addon automatically sends the account verification email (through firebase) if the account is not emailVerified.
Client(register)->Server(firebaseRegister)->Server(mmoRegister)->Client(success)
Client(login)->Server(firebaseLogin)->Server(firebaseGetUserData)->Server(checkEmailVerified || checkUserDisabled)->Server(mmoLogin)->Client(success)
If user is registered in firebase but not mmoKit, addon automatically registers them in mmoKit upon Login.
If firebase password changed but mmoKit hasn't, addon automatically updates the firebase password in mmoKit.
With this addon, any password change/reset needs to be done from Firebase.
https://assetstore.unity.com/packages/templates/systems/mmorpg-kit-2d-3d-survival-110188
https://assetstore.unity.com/packages/tools/network/rest-client-for-unity-102501
https://github.com/GamerzDan/MMORPGKIT-Reset-Password-Addon
- Create your Free Firebase account by signing in with a google account (https://console.firebase.google.com/) and setup your project. Open your project's settings and copy the WEB API KEY. You need to save/replace this key in CentralNetworkManager_APIManager.cs (under APIManager folder).
- Increase username character length limit to 255 in CentralNetworkManager (via Unity Inspector)
- Install other Required Dependencies
- Drag and Drop this addon to your project (under Assets folder or any sub-folder within it)
- Edit the UIMmoLogin.cs and UIMmoRegister.cs
(UnityMultiplayerARPG/MMO/Scripts/MMOGame/UI/)
classes of the MMORPGKIT to partial classes
Change
public class UIMmoLogin : UIBase
public class UIMmoRegister : UIBase
to
public partial class UIMmoLogin : UIBase
public partial class UIMmoRegister : UIBase
- To use the Firebase Addon's login or registration system, you need to call
tryMMOLogin();
ortryMMORegister();
(Method 1)
Since this Addon uses Partial Classes, this is as easy as finding the Login/Registration UI Button object in your project and change it's OnClick() method.
(Method 2 - EASY)
Easiest way is to just edit the kit's UIMmoLogin or UIMmoRegister class's OnClickLogin
or OnClickRegister()
methods and call the tryMMOLogin();
or tryMMORegister();
at start itself and return or comment the rest of the code.