SPFx adal acquire token renewal failed

SPFx adal acquire token renewal failed



I have created an angular-adal SPFx project, now when I'm trying to acquire the token. It always displays a message:



Token renewal operation failed due to timeout


adal.acquireToken("Dynamic 365 API", (error, token)=>

console.log("error");

);



EDIT



After using the inbuilt spfx AadHttpClient, the issue which I am Facing.


AadHttpClient



Error: The requested operation is part of an experimental feature that
is not supported in the current environment.



Code


this.context.aadHttpClientFactory.getClient('https://tenant.onmicrosoft.com/ApplicationId').then((client: AadHttpClient): void =>
client.get('https://graph.microsoft.com/v1.0/me', AadHttpClient.configurations.v1).then((response: HttpClientResponse): Promise<JSON> =>
debugger;
return response.json();
)
.then((responseJSON: JSON): void =>

debugger;
var claimsTable = this.domElement.getElementsByClassName("azFuncClaimsTable")[0];
for (var key in responseJSON)
var trElement = document.createElement("tr");
// trElement.innerHTML = `<td class="$styles.azFuncCell">$key</td><td class="$styles.azFuncCell">$responseJSON[key]</td>`;
claimsTable.appendChild(trElement);

);
);



Line where error comes


client.get('https://graph.microsoft.com/v1.0/me', AadHttpClient.configurations.v1).then((response: HttpClientResponse): Promise<JSON> => {



Image Description



Error: The requested operation is part of an experimental feature that is not supported in the current environment.



Thanks for the help!




1 Answer
1



If possible, I recommend you to upgrade your solution to the latest SPFx 1.6 version and get rid of adal.js in your code. Read here more about the release and how to upgrade your solution.


adal.js



Why I suggest moving to 1.6:


adal.js


adal.js



This great article by @Vardhaman Deshpande contains a very good sample on how to call Azure AD protected API hosted as Azure function with SPFx 1.6 features.






Can I call this API: https://graph.microsoft.com/v1.0/me?

– Utkarsh Dubey
Sep 11 '18 at 11:14


https://graph.microsoft.com/v1.0/me






Sure, you can call it

– Sergei Sergeev
Sep 11 '18 at 11:16






Please! check my edits.

– Utkarsh Dubey
Sep 12 '18 at 7:01






Since you need MS Graph, then please use GraphClient which is even simpler. If you see "experimental feature", please follow these steps (comment) to resolve it

– Sergei Sergeev
Sep 12 '18 at 7:18






also please make your user and administrator and admin site collection, for that purpose follow these steps

– Sergei Sergeev
Sep 12 '18 at 7:21



Thanks for contributing an answer to SharePoint Stack Exchange!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế