'Angularx-social-login MicrosoftOffice How to add scopes

I'm currently building a website using Angular and I would like to login with the office API

To do so I'm using the angularx-social-login lib but I can't add scopes (It seems that the way I'm doing it or the lib just doesn't care about the scopes I give it) Here's my code

import { FacebookLoginProvider, GoogleLoginProvider, MicrosoftLoginProvider, SocialAuthService } from 'angularx-social-login';

async loginWithMicrosoft() {
    let officeLoginOptions = {
      scope: "openid profile email User.Read Tasks.ReadWrite Contacts.Read Contacts.ReadWrite Mail.Read Mail.Send Mail.Read Mail.ReadBasic Mail.ReadWrite Calendars.Read Calendars.ReadWrite Calendars.ReadWrite.Shared Calendar.Read.Shared",
    }
    const userResponse = await this.socialAuthService.signIn(
      MicrosoftLoginProvider.PROVIDER_ID,
      officeLoginOptions
    );
    this.apiService
      .sendPostRequest("auth/login", {
        office_token: userResponse.response.accessToken,
      })
      .subscribe({
        next: (data) => {
          console.log("Data", data);
          this.apiService.saveToken(data.token);
          window.location.href = "/dashboard";
        },
      });
  }

Does anyone know how to do it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source