Forum Discussion
Authenticating with an access token Connect-MicrosoftTeams
- Oct 15, 2021FYI - I raised a ticket, and it should be fixed by mid november.
Issue description:
Cannot properly run Connect-MicrosoftTeams -AccessTokens
Resolution Steps:
Escalated case with our engineering Team
Issue is known bug and currently being fixed
Expecting a fix to go out by NOV mid
Hi @Sridevi-MSFT,
I've also started experiencing this issue today. Was working fine before, but now I get the error: " The provided tokens must have less than 180 seconds difference in the time range of expiration."
Using Teams PowerShell Module 2.3.2 with a graph token and a Teams token that are created at the same time, but the expiration time can be as great as 20min.
- petethemanNov 15, 2021Copper Contributor
Hi Thomsch Sridevi-MSFT
I do the following two requests to get the tokens the payload is below
Graph Token
https://login.microsoftonline.com/common/oauth2/v2.0/token
client_id=redacted
&scope=Directory.AccessAsUser.All
&code=redacted
&redirect_uri=redacted
&grant_type=authorization_code
&client_secret=redacted
Teams Token
https://login.microsoftonline.com/common/oauth2/token
resource=48ac35b8-9aa8-4d74-927d-1f4a14a0b239
&client_id=redacted
&refresh_token=redacted
&redirect_uri=redacted
&grant_type=refresh_token
&client_secret=redacted
But the token expiry time of the two tokens are always more than 180 seconds.
Graph JWT"aud": "00000003-0000-0000-c000-000000000000",
"iss": "https://sts.windows.net/redacted/",
"iat": 1637048601,
"nbf": 1637048601,
"exp": 1637054055,
Teams JWT"aud": "48ac35b8-9aa8-4d74-927d-1f4a14a0b239",
"iss": "https://sts.windows.net/redacted/",
"iat": 1637048627,
"nbf": 1637048627,
"exp": 1637053010,
Time difference = 1045 secondsSo this will result in the error that the expiry time difference is greater than 180 seconds.
Is there something wrong with the way I am requesting a token, or is there a change in the token issuing logic that is not compatible with the Teams Connector?
Kind regards
Peter
- SajAccess4Nov 15, 2021Copper Contributor
I'm still unable to get it work. I'm still receiving an error "Connect-MicrosoftTeams : The provided tokens must have less than 180 seconds difference in the time range of expiration."
I have not been able to figure out how to configure the expiration of the tokens as we generate the tokens at the same time and the difference in expiration is approx. 800 seconds.