Authorizing and authenticating users using Auth0

Our authorization is going to consist of two parts—a service to perform the authorization, and a model to make working with the authorization simple. We will start off by creating our Authorization model, which contains the details we will receive back from a successful login. Note that the constructor brings in the Socket instance:

export class Authorization {  constructor(private socket: Socket);  public IdToken: string;  public AccessToken: string;  public Expired: number;  public Email: string;}

We can use this to create a series of useful helper methods. The first one we are going to create is a method to set the public properties if the user logs in. We are identifying a successful login as ...

Get Advanced TypeScript Programming Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.