You need a different type of auth token than what you are using.
This article talks about using a PowerShell library to get it using AADInternals
$teamsToken = Get-AADIntAccessTokenForTeams
Source:
https://medium.com/@mozzeph/automate-setting-work-location-in-teams-outlook-poc-deb7b05de08d