Search Unity

Question login system via a special restAPI

Discussion in 'Scripting' started by codeBatt, Jan 28, 2023.

  1. codeBatt

    codeBatt

    Joined:
    Feb 12, 2020
    Posts:
    40
    I need to program a simple user and password login (accessing a backend server - to provided endpoints) on the mobile game which made wih Unity.

    I than need to submit final score to endpoints as well (after successful login) to a leaderboard in a backend-server. The API is in the link and I do not know even where to start, could anyone help me on what should I do implementing this?

    API:https://api.joinzeus.xyz/docs

    I once made a connecting a game to firebase for this purpose.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,697
    I would just use firebase or Google login, or if you're on Apple use Apple Sign-in.

    Why reinvent the wheel?

    With GDPR and CCPA and all the myriad draconian privacy protection laws, you absolutely positively DO NOT WANT to start collecting user information unless you have a massive legal team to defend you against the lawsuits.
     
  3. codeBatt

    codeBatt

    Joined:
    Feb 12, 2020
    Posts:
    40
    I totally agree, just a given task.. I told many times they do not want to understand
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,697
    I suppose the first step would be to design a UX flow:

    - new user -> registration, collect info, send to server to record

    - returning user -> login, send to server, validate

    Then decide how you want to auth: a session key? A magic cookie? re-sending the userid/pw each time?

    Each way has pros and cons and pitfalls.

    Once you have the login / auth going, submitting the score is just another server call where it records the score in a database.

    When you're ready to display the best score, make a server endpoint that searches the database of scores for the highest one and returns it

    It's all pretty straightforward stuff and only a tiny bit of it has anything to do with Unity. The bulk of it is server / backend / networking, etc.

    PS - don't forget:

    - "I forgot my username!"
    - "I forgot my password!"
    - "I want to change my username!"
    - "I want to change my password!"

    and of course:

    - "delete my account"
     
    Last edited: Jan 28, 2023
    codeBatt likes this.