Hi @IBN
Based on the information you've provided, it seems you're trying to get the list of messages in a channel of team in which you're not a member. Please make sure you use Application Permissions and have request access to use this Protected API.
Refer- https://learn.microsoft.com/en-us/graph/teams-protected-apis
Please fill this request form for the same.
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.