Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 961 Bytes

authentication.md

File metadata and controls

34 lines (24 loc) · 961 Bytes

Authentication

Authentication is handled by a dedicated IdP. The default implementation of the software system uses a self-hosted instance of Supertokens.

Guide

By default all requests going to the api service requires authentication and is done on the gateway layer. It is possible to create unauthenticated routes (e.g. for healthchecks) by creating explicit ingress routes without authentication.

Accessing user info

In order to access user info, one should use the AuthenticationModule.

import { Injectable } from "@nestjs/common";

import { UserIdService } from "src/core/authentication";

@Injectable()
export class MonkeyService {
  constructor(private readonly userIdService: UserIdService) {}

  async getMonkeyEmail(): Promise<void> {
    const userId = this.userIdService.getUserId();
    const emails = await this.userIdService.fetchUserEmailsByUserIds([userId]);

    doStuff(emails);
  }
}