Hi @Duy Huynh ,
Thanks for reaching out.
From your query I understood that you are getting error when trying to aquire the token using console app's identity.
This error is generally due to when scopes are not defined correctly or admin consent has not been granted for the defined permissions.
As per sample , application permissions has been assigned to the application.
Application permissions has been used when there is no user interaction so these permissions always require admin consent ahead of time where as Delegated permissions has been used where application need to signed in user, in that admin consent is require only for some specific permissions.
Admin consent can be granted by clicking on Grant Admin consent for {Tenant Name} by navigating to Configured Permissions in Application Registration->Manage-> API permissions
Once Admin consent has been granted, status of the permissions has been changed to granted to access the application and allow your application to get the token with defined scopes and further access the resources based on scopes in the token.
Hope this will help.
Thanks,
Shweta
---------------------------------------------------------------------------------------
Please remember to "Accept Answer" if answer helped you.