botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

ConnectorClient throws exception

Open RaffaelHold opened this issue 10 years ago • 9 comments

var response = await connector.Conversations.SendToConversationAsync((Activity)newMessage); throws the following exceptions

Authorization for Microsoft App ID 3e12ac5b-144a-4910-96b2-c67782d6d9ab failed with status code Forbidden

Invalid token. System.IdentityModel.Tokens.SecurityTokenSignatureKeyNotFoundException: IDX10500: Signature validation failed. Unable to resolve SecurityKeyIdentifier: 'SecurityKeyIdentifier ( IsReadOnly = False, Count = 2, Clause[0] = X509ThumbprintKeyIdentifierClause(Hash = 0x3270BF5597004DF339A4E62224731B6BD82810A6), Clause[1] = System.IdentityModel.Tokens.NamedKeySecurityKeyIdentifierClause ) ', token: '{"typ":"JWT","alg":"RS256","x5t":"MnC_VZcATfM5pOYiJHMba9goEKY","kid":"MnC_VZcATfM5pOYiJHMba9goEKY"}.{"aud":"https://graph.microsoft.com","iss":"https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/","iat":1468491953,"nbf":1468491953,"exp":1468495853,"appid":"3e12ac5b-144a-4910-96b2-c67782d6d9ab","appidacr":"1","idp":"https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/","tid":"72f988bf-86f1-41af-91ab-2d7cd011db47","ver":"1.0"}'. at System.IdentityModel.Tokens.JwtSecurityTokenHandler.ValidateSignature(String token, TokenValidationParameters validationParameters) in c:\workspace\WilsonForDotNet45Release\src\System.IdentityModel.Tokens.Jwt\JwtSecurityTokenHandler.cs:line 943 at System.IdentityModel.Tokens.JwtSecurityTokenHandler.ValidateToken(String securityToken, TokenValidationParameters validationParameters, SecurityToken& validatedToken) in c:\workspace\WilsonForDotNet45Release\src\System.IdentityModel.Tokens.Jwt\JwtSecurityTokenHandler.cs:line 671 at Microsoft.Bot.Connector.JwtTokenExtractor.d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Connector.JwtTokenExtractor.d__6.MoveNext() 2016-07-14T10:30:56 PID[628632] Warning Invalid token. System.IdentityModel.Tokens.SecurityTokenSignatureKeyNotFoundException: IDX10500: Signature validation failed. Unable to resolve SecurityKeyIdentifier: 'SecurityKeyIdentifier ( IsReadOnly = False, Count = 2, Clause[0] = X509ThumbprintKeyIdentifierClause(Hash = 0x3270BF5597004DF339A4E62224731B6BD82810A6), Clause[1] = System.IdentityModel.Tokens.NamedKeySecurityKeyIdentifierClause ) ', token: '{"typ":"JWT","alg":"RS256","x5t":"MnC_VZcATfM5pOYiJHMba9goEKY","kid":"MnC_VZcATfM5pOYiJHMba9goEKY"}.{"aud":"https://graph.microsoft.com","iss":"https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/","iat":1468491953,"nbf":1468491953,"exp":1468495853,"appid":"3e12ac5b-144a-4910-96b2-c67782d6d9ab","appidacr":"1","idp":"https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/","tid":"72f988bf-86f1-41af-91ab-2d7cd011db47","ver":"1.0"}'. at System.IdentityModel.Tokens.JwtSecurityTokenHandler.ValidateSignature(String token, TokenValidationParameters validationParameters) in c:\workspace\WilsonForDotNet45Release\src\System.IdentityModel.Tokens.Jwt\JwtSecurityTokenHandler.cs:line 943 at System.IdentityModel.Tokens.JwtSecurityTokenHandler.ValidateToken(String securityToken, TokenValidationParameters validationParameters, SecurityToken& validatedToken) in c:\workspace\WilsonForDotNet45Release\src\System.IdentityModel.Tokens.Jwt\JwtSecurityTokenHandler.cs:line 671 at Microsoft.Bot.Connector.JwtTokenExtractor.d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Connector.JwtTokenExtractor.d__6.MoveNext()

Yesterday everything worked fine and today the error appeared, I already triple checked that appId & password are correct. I also registered a completely new bot and validated the connection in the botframework portal.

RaffaelHold avatar Jul 14 '16 10:07 RaffaelHold

We're seeing this on a few different bots -- I'm investigating.

dandriscoll avatar Jul 14 '16 16:07 dandriscoll

Hi @RaffaelHold, are you seeing this error against the emulator, or one of the channels? If it's a channel, which channel are you seeing the error with?

dandriscoll avatar Jul 14 '16 17:07 dandriscoll

Im seeing it against the emulator and skype. It happens every request so if you have ideas I can easily try them out.

I dont have the repo accessible right now, but i can try additional channels tomorrow

RaffaelHold avatar Jul 14 '16 17:07 RaffaelHold

@RaffaelHold can you email us at [email protected]. I want you to help us diagnosing this issue by creating a minidump with heap from this error case and share it with us. Since minidumps are large, probably it makes sense to email us first and I give you a share to copy the minidump in.

msft-shahins avatar Jul 15 '16 21:07 msft-shahins

@msft-shahins How's a minidump going to help you here?

I am also experiencing this issue, however it does not seem to be blocking my emulator testing. Looks like the exception is being handled by this.

Also is this related?

suprak avatar Jul 19 '16 04:07 suprak

@suprak we haven't seen a repro of this locally and minidump will help us debugging how this problem might happen.

msft-shahins avatar Jul 19 '16 06:07 msft-shahins

@msft-shahins did you see my emails? I uploaded another dump

RaffaelHold avatar Jul 19 '16 11:07 RaffaelHold

@RaffaelHold thanks for sending the dump. We are trying to figure out the issue using the dump you provided.

msft-shahins avatar Jul 19 '16 18:07 msft-shahins

How was this issue solved?

gsegares avatar Jul 29 '16 20:07 gsegares