Authentication - AppleGamer22/scr-web GitHub Wiki

User Database Document

  • Social network username (String object)
  • password hash
  • Sign-in date (Date object)
  • Social network type ("instagram", "tiktok" or "vsco")
  • Boolean for Instagram authentication
  • Document ID (key of _id)

Server API

PATCH api/sign_up/instagram

  1. Accepts HTTP JSON body of {username: String, password: String},
  2. hashes password
  3. and saves user record without signing-in.

PATCH api/sign_in/instagram

  1. Accepts HTTP JSON body of {username: String, password: String},
  2. compares password hash,
  3. signs-in to Instagram through Puppeteer.
    • If sign-in ended successfully, an HTTP JSON response of {toke: String} is returned with JSON Web Token (JWT).

PATCH api/sign_out/instagram

  1. Accepts HTTP header with JWT in the Authorisation field,
  2. signs-out to Instagram through Puppeteer.
    • If sign-out ended successfully, an HTTP JSON response of {status: false} is returned.