ClientAuthError: User login is required. For silent calls, request must contain either sid or login_hint

Patrick Rote 101 Reputation points
2021-06-16T10:30:03.537+00:00

I'm using MSAL.js to acquire a silent token and it works ok when i login See my snippet code below

  var userid = _spPageContextInfo.userId;  
    //console.log(email);  
var upn = getUserEmailByLoginName(userid);  
  
var config = {    
    auth: {    
        clientId: "",    
        authority: "https://login.microsoftonline.com/techie.onmicrosoft.com"    
        redirectUri: "someUrl",  
    },    
    cache: {    
        cacheLocation: "localStorage"            
    }    
};    
var requestPermissionScope = {    
     scopes: ["user.read"],  
     loginHint: upn,--setting the email address here e.g ******@xyz.com (is this the loginHint?  
   //extraQueryParameters: {domain_hint: 'organizations'}    
};    

The issue i'm facing though is when another user logs in the get this error below

ClientAuthError: User login is required. For silent calls, request must contain either sid or login_hint

106607-image.png

In regards to the loginHint. What value do we need? Is it an email address?

In this article

it says prefered_username. But what is it?

Thanks in Advance

Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

5 answers

Sort by: Most helpful
  1. Patrick Rote 101 Reputation points
    2021-07-05T05:42:17.53+00:00

    Thanks Deva-MSFT.
    Where can i get the latest msal.js version?

    0 comments No comments

  2. Patrick Rote 101 Reputation points
    2021-07-06T09:06:08.88+00:00

    Not sure if anyone else here can confirm
    Is the below the latest version?

    <script type="text/javascript" src="https://alcdn.msauth.net/lib/1.4.11/js/msal.min.js"></script>

    Thanks


  3. Patrick Rote 101 Reputation points
    2021-07-13T11:17:30.447+00:00

    Thats the samething i posted.
    Thanks

    0 comments No comments

  4. Salla, Jyothsna 1 Reputation point
    2022-06-09T18:26:51.63+00:00

    Did you find an answer for this? i am trying to get token from sharepoint online. By using new msal 2.0 the following error is prmopted.
    UserAgentApplication is not a constructor.
    changing to old msal gives below.

    ncaught (in promise) ClientAuthError: User login is required.
    at ClientAuthError.AuthError [as constructor] (AuthError.ts:20:9)
    at new ClientAuthError (ClientAuthError.ts:98:9)
    at Function.ClientAuthError.createUserLoginRequiredError (ClientAuthError.ts:173:16)
    at UserAgentApplication.ts:585:39
    at new Promise (<anonymous>)
    at UserAgentApplication.acquireTokenSilent (UserAgentApplication.ts:569:12)
    at UserAgentApplication.descriptor.value [as acquireTokenSilent] (UserAgentApplication.ts:130:36)
    at RetrieveAccessToken (ServiceHealth.aspx:932:24)

    0 comments No comments

  5. Afzal K 1 Reputation point
    2022-06-10T04:56:38.573+00:00

    i have also same issue existing from this library..

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.