question

PatrickRote-3473 avatar image
0 Votes"
PatrickRote-3473 asked AfzalK-9316 edited

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

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


azure-ad-msal
image.png (33.4 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I see that you're using older MSAL.js (v1.4.0). Can you try the same with latest MSAL.js and see if you can repro the issue or not.

0 Votes 0 ·
PatrickRote-3473 avatar image
0 Votes"
PatrickRote-3473 answered

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

PatrickRote-3473 avatar image
0 Votes"
PatrickRote-3473 answered vipulsparsh-MSFT commented

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

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@PatrickRote-3473 You can check it here : https://docs.microsoft.com/en-us/azure/active-directory/develop/reference-v2-libraries
If you have any other questions, please let me know.
Thank you for your time and patience throughout this issue.



Please remember to Accept Answer if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

0 Votes 0 ·
PatrickRote-3473 avatar image
0 Votes"
PatrickRote-3473 answered

Thats the samething i posted.
Thanks

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SallaJyothsna-7336 avatar image
0 Votes"
SallaJyothsna-7336 answered

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)

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AfzalK-9316 avatar image
0 Votes"
AfzalK-9316 answered AfzalK-9316 edited


i have also same issue existing from this library..


[1]: /answers/storage/attachments/210069-image.png


image.png (112.4 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.