Class: AuthService

services/AuthService~AuthService(googleClient)

new AuthService(googleClient)

Constructor for AuthService class

Parameters:
Name Type Description
googleClient OAuth2Client

Google OAuth2Client object

Source:

Methods

(async) checkUser(payload) → {Promise.<Document>}

Checks if user exists in blockout database and creates one if not.

Parameters:
Name Type Description
payload TokenPayLoad

payload object that represents user information

Source:
Returns:
  • Returns the promise of a document object representing the new/existing user
Type
Promise.<Document>

(async) signIn(idToken)

Handles the sign in process and returns the mongoDB document

Parameters:
Name Type Description
idToken string

userid token sent from client frontend

Source:
Returns:
  • Returns the promise of a document object representing the new/existing user

(async) verifyToken(token) → {Promise.<TokenPayLoad>}

Verifies token with Google OAuth2

Parameters:
Name Type Description
token string

userid token sent from client frontend

Source:
Returns:

payload - payload object that represents user information

Type
Promise.<TokenPayLoad>