Below code im using the Documentation based but im getting "Tenant does not have a SPO license." this error

Aravind Kumar 0 Reputation points
2023-12-05T11:53:13.0966667+00:00
// authService.js
import { UserAgentApplication } from "msal";

const msalConfig = {
  auth: {
    // clientId: "984bc6b9-e5fd-4710-8aa4-b78ab49cf010",
    clientId: "369586e6-a294-4a0a-85f2-7dd7a779280d",
    authority:
      "https://login.microsoftonline.com/6bb2d997-f741-4de0-abbd-73a726f3c0c5",
    redirectUri: "http://localhost:3000",
    endpoints: {
      "https://graph.microsoft.com": "https://graph.microsoft.com",
    },
  },
};

const msalInstance = new UserAgentApplication(msalConfig);

const login = async () => {
  const loginRequest = {
    scopes: [
      "Files.ReadWrite.All",
      "openid",
      "profile",
      "user.read",
      "Sites.ReadWrite.All",
    ],
  };
  try {
    const response = await msalInstance.loginPopup(loginRequest);
    console.log("Login successful", response);
  } catch (error) {
    console.error("Login error:", error);
  }
};

const logout = () => {
  msalInstance.logout();
};

const getToken = async () => {
  const tokenRequest = {
    scopes: [
      "Files.ReadWrite.All",
      "openid",
      "profile",
      "user.read",
      "Sites.ReadWrite.All",
    ],
  };

  try {
    const response = await msalInstance.acquireTokenSilent(tokenRequest);
    console.log(response);
    return response.accessToken;
  } catch (error) {
    if (error.name === "InteractionRequiredAuthError") {
      await login();
    } else {
      console.error("Token acquisition error:", error);
    }
  }
};

export default {
  login,
  logout,
  getToken,
};
   


import React, { useEffect } from "react";
import { Client } from "@microsoft/microsoft-graph-client";

const DriveList = (props) => {
  const { accessToken } = props;

  const getAllItems = async () => {
    try {
      const options = {
        authProvider: (done) => {
          done(null, accessToken);
        },
      };

      const client = Client.init(options);
      const drive = await client.api("/me/drive/recent").get();
      console.log("Drive Information:", drive);
    } catch (error) {
      console.error("Error fetching drive information:", error.message);
    }
  };

  useEffect(() => {
    getAllItems();
  }, [accessToken]);

  return <>DriveList;
};

export default DriveList;

https://learn.microsoft.com/en-us/answers/questions/886555/aadsts700054-response-type-id-token-is-not-enabled these setups also im setupted correctly.But alse throwing same errorn notation. Anyne provide me this error details...... !

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,789 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,594 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 33,401 Reputation points Microsoft Vendor
    2023-12-06T02:27:03.9366667+00:00

    Hi @Aravind Kumar

    According to the documentation. The /tenant id or /contoso.onmicrosoft.com endpoint only allows users with work/school accounts of a specific Azure AD tenant to log in to the application. It does not support personal accounts. Please check if you are using personal account


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.