// 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://video2.skills-academy.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...... !