Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Login with email code verification

Discussion in 'Scripting' started by astingengo, Jul 14, 2022.

  1. astingengo

    astingengo

    Joined:
    Apr 28, 2022
    Posts:
    25
    Hi there,

    I would like to know how the flow should be [nothing code related] regarding making a login with code verification sent on email.

    Something like:
    - Press login button
    - Go to email form
    - Add email press login button
    - Verification game object is presented where it ask about code sent on the email
    - Code is entered and verification button is presset

    How should this look like as a flow standpoint vegarding backend and how should I keep the user signed in?

    So I'm thinking to have a field email, code_verification and code_expiration_date
    When user wants to login, a new code_verification will be generated and code_expiration_date will be = with current date + 1 hour.

    If email is corrent and code_verification is corrent but entered in the first hour (current date/time is not > code_expiration_date), I'll loggin the user and load game data, if not ...

    The problem is that: what should be the flow to keep the user in signed in?

    Regards,
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,522
    Wow, that's a massive undertaking, fraught with ALL the intersecting privacy laws (such as GDPR the EU, CCPA in California, and now the LGPD in Brazil).

    I cannot even imagine where I would begin researching something as dangerous as this in 2022. You are seriously exposing yourself to massive liabilities if you leak people's data!

    I would just use something like Google sign-in or Apple sign-in, or else you are looking at a metric ton of work.
     
    astingengo likes this.
  3. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,186
    Agree, Google, Apple, or if you want to use email, go with some backend that already supports it. They should have everything in place for you. Firebase is a good one for this, but there are a ton of other ones. Even Unity I think now offers a free tier to support account management for your players, just don't know how much you get for free.
     
    Yoreki, astingengo and Kurt-Dekker like this.
  4. astingengo

    astingengo

    Joined:
    Apr 28, 2022
    Posts:
    25
    Uh. Thank you