Auth service is not working in Angular project

I am using Angular and Moralis to make an NFT marketplace.

So far, I am using this bit of code in my signin component to login the user using their metamask extension:

import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { AuthService } from '@core/services';
import { environment } from '@environments/environment';
import { Moralis } from 'moralis';

export type User = Moralis.User<Moralis.Attributes>;

  selector: 'signin-page',
  templateUrl: './signin-page.component.html',
  styleUrls: ['./signin-page.component.scss'],
export class SigninPage implements OnInit {
  user?: User;

  constructor(private router: Router, private authService: AuthService) {}

  ngOnInit(): void {
      appId: environment.moralis.appId,
      serverUrl: environment.moralis.serverUrl,
      .then(() =>'Moralis has been initialised.'))
      .finally(() => {
        this.authService.isAuthorized = true;

  login(provider: 'metamask' | 'walletconnect' = 'metamask') {
    (provider === 'metamask'
      ? Moralis.Web3.authenticate()
      : Moralis.Web3.authenticate({ provider })
      .then((loggedInUser) => {
      .catch((e) => console.error(`Moralis '${provider}' login error:`, e));

  private setLoggedInUser(loggedInUser?: User) {
    this.user = loggedInUser;
    this.authService.isAuthorized = true;'Loggedin user:', loggedInUser);

and as you can see, I want to set isAuthorized to true in my auth service so that I’m able to use it all over application but it’s not working and isAuthorized stays false all throughout the signin process.

here’s my auth service code:

import { Injectable } from '@angular/core';
import { Moralis } from 'moralis';

export type User = Moralis.User<Moralis.Attributes>;

  providedIn: 'root',
export class AuthService {
  user?: User;

  private _isUserAuthorized: boolean = false;

  constructor() {}

  ngOnInit() {}

  changeUser(user?: User) {
    this.user = user;
    this.isAuthorized = true;

  get isAuthorized(): boolean {
    return this._isUserAuthorized;

  set isAuthorized(value: boolean) {
    this._isUserAuthorized = value;

I’m not familiar with this syntax, can you check that the lines of code that set isAuthorized get to execute by adding before and after those lines?
I noticed that you use twice this.authService.isAuthorized = true;, not sure if intended.