After reading the articel https://docs.microsoft.com/de-de/sharepoint/dev/spfx/use-aad-tutorial I tried to implement the AadHttpClient to query the Azure AD. Everything works fine while development but now we try to set the solution to productive.
We get the following error at the browsers console window:
Error
columnNumber: 33832
fileName: "https://spoprod-a.akamaihd.net/files/sp-client-prod_2018-04-27.025/sp-pages-assembly_de-de_fe39afc9a02d6a7fc3dec634a0dd4931.js"
lineNumber: 592
message: "User login is required"
>
stack: "__WEBPACK_AMD_DEFINE_RESULT__https://spoprod-a.akamaihd.net/files/sp-client-prod_2018-04-27.025/sp-pages-assembly_de-de_fe39afc9a02d6a7fc3dec634a0dd4931.js:592:33832\n[6]/iacquireToken@https://spoprod-a.akamaihd.net/files/sp-client-prod_2018-04-27.025/0.sp-http-adal_4a41848c866052caa755.js:3:11368\n__WEBPACK_AMD_DEFINE_RESULT__https://spoprod-a.akamaihd.net/files/sp-client-prod_2018-04-27.025/sp-pages-assembly_de-de_fe39afc9a02d6a7fc3dec634a0dd4931.js:592:33400\n__WEBPACK_AMD_DEFINE_RESULT___acquireTokenPromise@https://spoprod-a.akamaihd.net/files/sp-client-prod_2018-04-27.025/sp-pages-assembly_de-de_fe39afc9a02d6a7fc3dec634a0dd4931.js:592:33262\n__WEBPACK_AMD_DEFINE_RESULT__https://spoprod-a.akamaihd.net/files/sp-client-prod_2018-04-27.025/sp-pages-assembly_de-de_fe39afc9a02d6a7fc3dec634a0dd4931.js:592:32853\n"`
We extracted the Azure AD related functions into a seperate TypeScript-Class like the following:
export default class AzureAdHelper{
constructor(context: WebPartContext){
this._aadClient = new AadHttpClient(context.serviceScope, "https://graph.microsoft.com");
}
private _aadClient: AadHttpClient;
The error occurs inside the following method while we trying to load users. The URL Parameter is filled with: https://graph.microsoft.com/beta/users?top=100&$filter=department eq 'BU-1' or Department eq 'BU-2'
private _singleSearchCallWithAad(url:string):Promise
{
return new Promise((resolve: (result: any) => void, reject: (error: any) => void) : void => {
this._aadClient
.get(url, AadHttpClient.configurations.v1)
.then(response => {
resolve(response.json());
})
.catch(error => {
console.error(error);
});
});
}`
Why we get the "User Login is required". I understood the AadHttpClient that it will handle the users Login process for me? Where is my mistake?
Have the same exact error message on my tenant. Only happens when the solution runs in production.
If we refresh the page a 2nd time, the login succeeds and the users are retrieved from Graph.
When debugging in workbench, the login succeeds automatically from the first page load. No error message.
Hi,
The following issue has been fixed. It should roll out shortly.
Thank you for you patience
We also get the User Login is required-error.
We use the AadHttpClient for calls to MS Office Graph, to our own REST API and a third party API. It's not clear, when we get this error, as sometimes it works and sometimes it doesn't.
Some additional information:
sp-classic-page-assembly.js.sp-classic-page-assembly.js.User Login is required-error is only thrown for one call though.From our understanding it looks like a bug in SP/SPFx as sometimes it works and sometimes it doesn't.
For us this is a very important functionality as we rely strongly on Azure-hosted APIs and cannot accept functionality that does not work in a reliable manor.
Do you have any information on
In case you have further questions or need some more technical details, please contact me. Thanks!
@lahuey - Great. Just for my understanding: Where will this be fixed? In SPFx, i.e. will we need a new SPFx version? Or is this fixed in code that is part of SP itself?
This will be fixed on the code in SP itself. It will require no code change on your end. I'll update this thread when it's rolled out to verify that you're no longer seeing the issue.
@vocaris out of curiosity: why are you using the AadHttpClient to connect to the Microsoft Graph rather than the MSGraphClient?
Hi
I've found that if you have more than one pending request in the Preview SharePoint Admin centre > API Management - you may have more than one permission request for the same thing, try to approve them, if you get an error, reject them. I saw this behaviour with the new PnP Starter Kit.
Paul
@waldekmastykarz while our first try's we got some other errors (propably our own mistakes) with the MSGraphClient... today I'm not remembering which errors but we were not able to handle them and so we decided to switch the the AadHttpClient which seems to wook correct...
@lahuey Is this now deployed? We have an issue since a little more than a week https://github.com/SharePoint/sp-dev-docs/issues/1934 - could this been have broken with this?
It should be working without the semaphore. Are you still seeing issues?
On Tue, Jun 12, 2018, 12:47 AM vocaris notifications@github.com wrote:
It seams to be working but with the issue #1934
https://github.com/SharePoint/sp-dev-docs/issues/1934 Nasicus
explained. So we implement the Semaphore
https://github.com/abrkn/semaphore.js/blob/master/lib/semaphore.js and
everything is fine...—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/SharePoint/sp-dev-docs/issues/1810#issuecomment-396497927,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHBvHL1W9EDyubpnZ3gan1dKGVCAyF3-ks5t73HtgaJpZM4T2Ltu
.
@lahuey just tested it on my demo app & our real app and in both it's working again.
Thank you!
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues
Most helpful comment
This will be fixed on the code in SP itself. It will require no code change on your end. I'll update this thread when it's rolled out to verify that you're no longer seeing the issue.