New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AadHttpClient - User login is required #1810

vocaris opened this Issue May 8, 2018 · 12 comments


None yet
8 participants

vocaris commented May 8, 2018


  • Question
  • Typo
  • Bug
  • Additional article idea

Expected or Desired Behavior

After reading the articel 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.

Observed Behavior

We get the following error at the browsers console window:


columnNumber: 33832

fileName: ""

lineNumber: 592

message: "User login is required"
stack: "WEBPACK_AMD_DEFINE_RESULT</</ye</e.prototype.acquireTokenPromise/</<@\n[6]/i</i.prototype.acquireToken@\n__WEBPACK_AMD_DEFINE_RESULT_</</ye</e.prototype.acquireTokenPromise/<@\n__WEBPACK_AMD_DEFINE_RESULT_</</ye</e.prototype.acquireTokenPromise@\n__WEBPACK_AMD_DEFINE_RESULT_</</ye</e.prototype.getToken/<@\n"`

Steps to Reproduce

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, "");
private _aadClient: AadHttpClient;

The error occurs inside the following method while we trying to load users. The URL Parameter is filled with:$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 => {
.get(url, AadHttpClient.configurations.v1)
.then(response => {
.catch(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?


This comment has been minimized.

AlessandroCondorelli commented May 16, 2018

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.


This comment has been minimized.


lahuey commented May 22, 2018


The following issue has been fixed. It should roll out shortly.

Thank you for you patience


This comment has been minimized.

PzYon commented May 22, 2018

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:

  • We are using SPFx 1.4.1.
  • We are using a classic page that we deploy by ourselves. On that page we place a modern/client web part. The exception is thrown in sp-classic-page-assembly.js.
  • I added the web part to a modern page and there it happens too, but the exception is thrown in sp-classic-page-assembly.js.
  • We can sometimes "fix" this error
    • by navigating to a modern page where our code is executed too (but only one API call is executed) and then navigation back to our classic page.
    • by clearing the browser cache, cookies, etc. and/or starting a new "private session"
  • As I said, we are calling different APIs using the AadHttpClient from within one SPFx web part and it happens with all the APIs. The 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

  • if and when this will be fixed?
  • any reliable workarounds?

In case you have further questions or need some more technical details, please contact me. Thanks!


This comment has been minimized.

PzYon commented May 22, 2018

@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 comment has been minimized.


lahuey commented May 22, 2018

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.


This comment has been minimized.


waldekmastykarz commented May 23, 2018

@vocaris out of curiosity: why are you using the AadHttpClient to connect to the Microsoft Graph rather than the MSGraphClient?


This comment has been minimized.

pkbullock commented May 24, 2018


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.



This comment has been minimized.

vocaris commented May 25, 2018

@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...

@Worrelpa Worrelpa referenced this issue Jun 3, 2018


Personal page webparts do not load #13

1 of 3 tasks complete

This comment has been minimized.

Nasicus commented Jun 4, 2018

@lahuey Is this now deployed? We have an issue since a little more than a week #1934 - could this been have broken with this?


This comment has been minimized.

vocaris commented Jun 12, 2018

It seams to be working but with the issue #1934 Nasicus explained. So we implement the Semaphore and everything is fine.

I did not close the issue because I'm still waiting for an offical statement from lahuey...


This comment has been minimized.


lahuey commented Jun 12, 2018


This comment has been minimized.

Nasicus commented Jun 12, 2018

@lahuey just tested it on my demo app & our real app and in both it's working again.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment