Hi,
It could be the issue in the assigned permissions. Make sure that, the permissions are assigned with 'Application Permission' and not with 'Delegated Permissions'
Hope this helps.
--please don't forget to upvote
and Accept as answer
if the reply is helpful--