Giter VIP home page Giter VIP logo

mmorpgkit-firebase-authbackend's Introduction

MMORPGKIT-Firebase-AuthBackend

Use FirebaseAuth as a Authentication and User Management backend for MMORPGKIT for Unity

Features

  • 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

Workflow

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.

Registration

Client(register)->Server(firebaseRegister)->Server(mmoRegister)->Client(success)

Login

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.

Required (install them before installing this addon)

MMORPGKIT (tested on v1.76)

https://assetstore.unity.com/packages/templates/systems/mmorpg-kit-2d-3d-survival-110188

Rest Client for Unity (tested on 2.62)

https://assetstore.unity.com/packages/tools/network/rest-client-for-unity-102501

MMORPGKIT-RESET-PASSWORD-ADDON

https://github.com/GamerzDan/MMORPGKIT-Reset-Password-Addon

Firebase Account

https://firebase.google.com/


Setup

  1. 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). enter image description here
  2. Increase username character length limit to 255 in CentralNetworkManager (via Unity Inspector)
  3. Install other Required Dependencies
  4. Drag and Drop this addon to your project (under Assets folder or any sub-folder within it)
  5. 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
  1. To use the Firebase Addon's login or registration system, you need to call tryMMOLogin(); or tryMMORegister();

(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 1 - Using UI Buttons

(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.
enter image description here

enter image description here

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.