Why couldn't I access using the above TokenCredentialAuthenticationProvider?
This is because you are using the wrong authorization flow to obtain the token. The client credential flow can only be used to call the /users/{user id}
endpoint because the flow is based on a daemon without user participation.
Because you are calling the /me
endpoint that requires user interaction, the client credential flow is clearly not for you. You can use Authorization code provider to solve this problem.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.