CLTracker / CLT-webapp

Other
6 stars 1 forks source link

When a POST request /login, send back user data as a JSON object if it's an existing user #15

Closed Syntaf closed 7 years ago

Syntaf commented 7 years ago

When a user authenticates (whether they are a new user or existing user), a JSON object will be posted to the /login route in the backend. This data will be a JSON object that resembles the following:

  {
    "email": "gmercer015@gmail.com",
    "email_verified": true,
    "name": "Grant Mercer",
    "given_name": "Grant",
    "family_name": "Mercer",
    "picture": "https://lh6.googleusercontent.com/-k0WgEvjGoVc/AAAAAAAAAAI/AAAAAAAACrM/ee8HnyRWMTc/photo.jpg",
    "gender": "male",
    "locale": "en",
    "updated_at": "2017-03-08T00:53:36.835Z",
    "user_id": "google-oauth2|105950922553210130192",
    "nickname": "gmercer015",
    "identities": [
        {
            "provider": "google-oauth2",
            "user_id": "105950922553210130192",
            "connection": "google-oauth2",
            "isSocial": true
        }
    ],
    "created_at": "2017-02-28T23:43:35.429Z",
    "last_ip": "70.189.192.82",
    "last_login": "2017-03-08T00:53:36.835Z",
    "logins_count": 2,
    "blocked_for": [],
    "guardian_enrollments": []
}

This was the data generated from me signing into the site using google. Now upon receiving this the backend must do:

stevenbrookslv commented 7 years ago

Changed slightly. Either way sending back whatever information may be relavant, but attaching to it a new key value pair to directly tell anyone calling the API whether the user is fresh and new (This is the first time they as a permitted user has tried to login) or whether they have previously logged in at all (They are a permitted exhib or organizer, and have already logged in before. "accountStatus": "newlyAdded" vs "accountStatus": "notNewlyAdded"