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

Error finding key for token - Skype Call

Open annevah opened this issue 8 years ago • 16 comments

Bot Info

  • SDK Platform: .NET
  • SDK Version: 3.13.1
  • Active Channels: Skype, Web chat
  • Deployment Environment: Azure App Service
  • App ID: 2ca2f4de-39c4-4d29-a812-01817f3f3092

Issue Description

The bot was working fine till yesterday. Message controller is working. The problem occurs when I try calling to the bot.

This is what I get in the output field when testing with ngrok:

iisexpress.exe Error: 0 : Error finding key for token. Available keys: e9d2Ej_yEdf2jCBDDJKVqsW-cXo, e9d2Ej_yEdf2jCBDDJKVqsW-cXo, oI2pysRK0KWZ9Jd0meQFJRHkyAE, oI2pysRK0KWZ9Jd0meQFJRHkyAE, b4ysOWItD13iQfLLeBFX9lRPDtk, b4ysOWItD13iQfLLeBFX9lRPDtk, QMrt9-4Jn43rldid1E-hByyRC_Q, QMrt9-4Jn43rldid1E-hByyRC_Q, GCxArXoN8Sqo7PweA7-z65denJQ, GCxArXoN8Sqo7PweA7-z65denJQ, M52DDXzhCd9LEhK6P6xszOFwApU, M52DDXzhCd9LEhK6P6xszOFwApU, jcZZmJ_oTfzxRl279RmddxC2rJI, jcZZmJ_oTfzxRl279RmddxC2rJI, YAJk7OgPGmt_qOu7DHj_E9cTb7s, YAJk7OgPGmt_qOu7DHj_E9cTb7s, WyM5Su8S01KUBTIgif5sIiDT_L8, WyM5Su8S01KUBTIgif5sIiDT_L8, MPL7UeVQQ_goYAnmVtQKBeh9jyc, MPL7UeVQQ_goYAnmVtQKBeh9jyc, yceHp93RzmN-kd8vCnKEulqI8Zo, yceHp93RzmN-kd8vCnKEulqI8Zo, E58u3c-zKB_0zQrLd9h6GyVr-ik, E58u3c-zKB_0zQrLd9h6GyVr-ik iisexpress.exe Warning: 0 : Invalid token. Microsoft.IdentityModel.Tokens.SecurityTokenSignatureKeyNotFoundException: IDX10501: Signature validation failed. Unable to match 'kid': 'kAjFbciiCrTIdZ_LarP3k_Y28Tw', token: '{ "alg": "RS256", "typ": "JWT", "kid": "kAjFbciiCrTIdZ_LarP3k_Y28Tw", "x5t": "kAjFbciiCrTIdZ_LarP3k_Y28Tw" }.{ "iss": "https://api.botframework.com", "aud": "2ca2f4de-39c4-4d29-a812-01817f3f3092", "exp": 1520414871, "nbf": 1520414571 }'. at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(String token, TokenValidationParameters validationParameters) at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateToken(String token, TokenValidationParameters validationParameters, SecurityToken& validatedToken) at Microsoft.Bot.Connector.JwtTokenExtractor.d__15.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__11.MoveNext()

When I am debugging using ngrok I getting the following message. image

The App ID and password given is correct because the message controller works fine. But what I find weird is that Microsoft.Bot.Builder.Calling nuget package has a dependency System.IdentityModel.Tokens.Jwt (>= 4.0.4.403061554 && < 5.0.0) and Microsoft.Bot.Builder has dependency System.IdentityModel.Tokens.Jwt (>= 5.1.4) I installed the packages ignoring the dependencies. What can be going wrong?

This is my packages file

<packages>
  <package id="Autofac" version="4.6.2" targetFramework="net46" />
  <package id="Chronic.Signed" version="0.3.2" targetFramework="net46" />
  <package id="EntityFramework" version="6.2.0" targetFramework="net46" />
  <package id="Microsoft.AspNet.WebApi" version="5.2.4" targetFramework="net46" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.4" targetFramework="net46" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.4" targetFramework="net46" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.4" targetFramework="net46" />
  <package id="Microsoft.Azure.KeyVault.Core" version="2.0.4" targetFramework="net46" />
  <package id="Microsoft.Bot.Builder" version="3.13.1" targetFramework="net46" />
  <package id="Microsoft.Bot.Builder.Calling" version="3.13.1" targetFramework="net46" />
  <package id="Microsoft.Bot.Connector" version="3.13.1" targetFramework="net46" />
  <package id="Microsoft.IdentityModel.Logging" version="5.2.1" targetFramework="net46" />
  <package id="Microsoft.IdentityModel.Protocol.Extensions" version="1.0.4.403061554" targetFramework="net46" />
  <package id="Microsoft.IdentityModel.Protocols" version="5.2.1" targetFramework="net46" />
  <package id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="5.2.1" targetFramework="net46" />
  <package id="Microsoft.IdentityModel.Tokens" version="5.2.1" targetFramework="net46" />
  <package id="Microsoft.Rest.ClientRuntime" version="2.3.10" targetFramework="net46" />
  <package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.3" targetFramework="net46" />
  <package id="Newtonsoft.Json" version="11.0.1" targetFramework="net46" />
  <package id="System.IdentityModel.Tokens.Jwt" version="5.1.4" targetFramework="net46" />
  <package id="WindowsAzure.Storage" version="9.1.0" targetFramework="net46" />
</packages>

annevah avatar Mar 07 '18 07:03 annevah

I have the same problem, it worked until monday

taranais avatar Mar 07 '18 09:03 taranais

+1

bydros avatar Mar 07 '18 09:03 bydros

I think I faced the same issue, too, tried for several hours.

  • My text message function on Skype bot worked fine, but when I call to the bot it replies "you can't talk to this bot just yet but we are working on it", and then hung up.
  • Tried to debug by ngrok, but my source code was not even been called, the error is : 401 Unauthorized, "BotAuthenticator failed to authenticate incoming request!"
  • Also tried to build new bot and new Skype bot channel but didn't fix the issue.

And just like @taranais mentioned, I can assure it used to worked fine two days ago.

james60338 avatar Mar 07 '18 15:03 james60338

Please try restarting the bot service and see if that fixes the issue

JasonSowers avatar Mar 07 '18 17:03 JasonSowers

@jasonsowers Nope. Tried that.

Any comment on the dependency conflict?

annevah avatar Mar 07 '18 17:03 annevah

@JasonSowers restarting azure app service did not fixed it neither localhost test with ngrok.

Conflict dependencies are not reference by project looking into the code... it seems a nuget conflict

https://github.com/Microsoft/BotBuilder/blob/d65ee48e47e9a116648d14a09f3b7d3878b8ce7e/CSharp/Library/Microsoft.Bot.Builder.Calling/Microsoft.Bot.Builder.Calling.csproj#L37-L63

https://github.com/Microsoft/BotBuilder/blob/d65ee48e47e9a116648d14a09f3b7d3878b8ce7e/CSharp/Library/Microsoft.Bot.Builder.Calling/Microsoft.Bot.Builder.Calling.nuspec#L18-L25

taranais avatar Mar 07 '18 18:03 taranais

Looking into this now I'll let you know what I find out, are you able to roll back to an earlier package to fix the issue?

JasonSowers avatar Mar 07 '18 18:03 JasonSowers

With 3.12.2.4 same issue, and before it works too.

iisexpress.exe Warning: 0 : Invalid token. Microsoft.IdentityModel.Tokens.SecurityTokenSignatureKeyNotFoundException: IDX10501: Signature validation failed. Unable to match keys: '[PII is hidden by default. Set the 'ShowPII' flag in IdentityModelEventSource.cs to true to reveal it.]', token: '[PII is hidden by default. Set the 'ShowPII' flag in IdentityModelEventSource.cs to true to reveal it.]'. en System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(String token, TokenValidationParameters validationParameters) en System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateToken(String token, TokenValidationParameters validationParameters, SecurityToken& validatedToken) en Microsoft.Bot.Connector.JwtTokenExtractor.d__15.MoveNext() --- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción --- en System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) en Microsoft.Bot.Connector.JwtTokenExtractor.d__11.MoveNext() Application Insights Telemetry: {"name":"Microsoft.ApplicationInsights.65b9146fd99546

taranais avatar Mar 07 '18 19:03 taranais

Is anyone reporting this issue using the Node.js SDK? or is everyone using .NET? @bydros @james60338 I see the others are using .NET already.

We are actively looking into this issue.

JasonSowers avatar Mar 07 '18 20:03 JasonSowers

@JasonSowers Its working for me now 😄 Is anyone still facing the issue?

annevah avatar Mar 08 '18 04:03 annevah

My bot works fine now, I did nothing on it. 😆

james60338 avatar Mar 08 '18 08:03 james60338

Working as intended now.

@JasonSowers What was the problem?. Could be nuget conflits be resolved?

taranais avatar Mar 08 '18 08:03 taranais

This should be working for everyone now. As for what happened, I do not have all the details of the situation at this time and do not want to put out bad information.

JasonSowers avatar Mar 08 '18 17:03 JasonSowers

@JasonSowers thank you, now is working for me as well

bydros avatar Mar 08 '18 18:03 bydros

it appears this situation has popped up again. any detail into what was wrong before?

peterkarman1 avatar Jul 24 '20 14:07 peterkarman1

I am also facing the same error....

ethanabrooks avatar Jun 27 '23 01:06 ethanabrooks