Hello and welcome to Microsoft Q&A! The error in question is one that pops up quite often, and usually happens when the credentials you use don't belong to the same Azure Active Directory as the Azure Digital Twins instance you're trying to use.
This Microsoft Learn page describes two ways to fix your issue. Let me know if that helps at all!