Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is difference between AcquireTokenForClient vs AcquireTokenSilent In MSAL.NET?

I have started using MSAL. now I have 2 implementation of getting token from MSAL #

 ##First one is##
app.AcquireTokenForClient(scopes).ExecuteAsync();

## another one is ##
 app.AcquireTokenSilent

what is difference between them ?

like image 716
Maulik Dave Avatar asked Sep 04 '25 01:09

Maulik Dave


1 Answers

AcquireTokenSilent() is for user based authentication and AcquireTokenForClient() is for app-only authentication (used in service to service calls, for example).

The AcquireTokenSilent needs an account parameter when called, so it can search the user token cache for a valid accessToken.

The AcquireTokenForClient only needs a scope parameter - there is no user context involved, the accessToken is acquired on behalf of the application itself.

like image 57
Sérgio Correia Avatar answered Sep 07 '25 21:09

Sérgio Correia