Auth API
Description of the functionality of Authentication API
API
Note: The following is defined in express/routes/auth.route.js
Check Login Data
<url>/auth
i.e. http://localhost:8080/auth/
Checking Authentication Token
<url>/auth/ token
i.e. http://localhost:8080/auth/token
Expiring Token Cookie
<url>/auth/ remove_token
i.e. http://localhost:8080/auth/remove_token
Middleware
Access through src/app/auth.service.ts
Importing Into Component
import { AuthService } from '../../survey.service';
... export class ... { constructor( ... , private authservice: AuthService) }
Functions
src/app/auth.service.ts
Checking Login Data
Contacts Auth API through HTTP to login and gain administrator access to private API calls.
login(admin: Admin)
Note: Cookie returned has form [ 'SESSION_ID', <token> ] with httpOnly, secure and strict flags set and an expiry depending on the settings configuration (default 7200 seconds).
Checking Authentication Cookie
Queries Auth API through HTTP given a cookie containing a JWT generated token (from the express, if a user/survey with these ids is in the database, returns user corresponding to this id pair.
checkAuth()
Logging Out/Expiring Cookie
Queries Survey API through HTTP to delete the secure token cookie.
logOut()
Last updated