question

KeitaYamashiro-8544 avatar image
0 Votes"
KeitaYamashiro-8544 asked HunaidHanfee-MSFT commented

Authentication errors when sending messages to Teams

The API is used in the following process.

  1. get token

  2. send a message to Teams using the obtained token

However, after you change the password of your Microsoft account, you will not be able to send messages to Teams.
You can get a token or update it with a refresh token.

The following APIs will generate error Unauthorized.

https://graph.microsoft.com/v1.0/teams/{team_id}/channels/{channel_id}/messages

If I change the password of my Microsoft account, will I not be able to use the Teams API?
I would appreciate it if someone could tell me.







office-teams-app-devmicrosoft-graph-teamwork
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@KeitaYamashiro-8544,
As we are mainly responsible for general question of Microsoft Teams, your question related to API is not in our scope. I will change office-teams-windows-itpro tag to office-teams-app-dev tag. Hope you get better response.

1 Vote 1 ·
RamjotSingh avatar image
0 Votes"
RamjotSingh answered HunaidHanfee-MSFT commented

We are tracking an issue where changing password can result into it taking a long time to get access to the API again (upto 1 day). For now if you wait for a day you should get access to the API again.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you for your answer.

I see that if I wait up to 24 hours, it will be available.
This makes sense, because when I tested it myself, I found that sometimes it took only an hour before I could use it, and other times it took 24 hours before I could use it.

0 Votes 0 ·

If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.

1 Vote 1 ·
michev avatar image
0 Votes"
michev answered KeitaYamashiro-8544 commented

Microsoft (personal) accounts are not supported for that endpoint, as documented here: https://docs.microsoft.com/en-us/graph/api/channel-post-messages?view=graph-rest-1.0&tabs=http
You need to use a work/Office 365 account. Other than that, make sure you have the required permissions.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you for your answer.

I made a mistake, I am trying with Office365, not Microsoft account. So before I changed the password, I can send messages to Teams without any problem.
After changing the password, I can't send any more.

0 Votes 0 ·
michev avatar image michev KeitaYamashiro-8544 ·

Have you cleared your token cache after the password change?

0 Votes 0 ·

Thanks for the reply.

I have not cleared the cache of the token.
After changing the password, the token is retrieved again using the following API.

/oauth2/v2.0/token


If I am using the API, how do I delete the token cache?

0 Votes 0 ·