There are several questions here and on git for v3 of the bot sdk wherein the bot gets 'unauthorized' responses after about an hour on my facebook channel, webchat works fine.
I have that problem in the v4 SDK, using .net core 2.1, AspNetCore 2.1.6 and using something trivial like the echobot c# example. It is not clear to me if the unauthorized is coming from microsofts bot framework, or from facebook itself.
Below is my code and the trace... Note that the failure appears to come out of : Microsoft.Bot.Builder.Integration.IAdapterIntegration.
My code: for the reply:
public async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken))
{
if (turnContext.Activity.Type == ActivityTypes.Message)
{
_logger.LogInformation("OnTurnAsync got message");
try
{
_logger.LogInformation("create activity");
Activity reply = turnContext.Activity.CreateReply();
_logger.LogInformation("send simple message");
await turnContext.SendActivityAsync("hello world");
...
the trace:
[Information] CISBaseBot.CISBaseBot: OnTurnAsync got message
[Information] CISBaseBot.CISBaseBot: create activity
[Information] CISBaseBot.CISBaseBot: send simple message
[Information] Microsoft.Bot.Builder.Integration.IAdapterIntegration: Sending activity. ReplyToId: TaqxSedy0NHkuz6v2d1SSDBtz0lj6KSn5cH__9maU0vjkxJiCcGelCs0gM-p7raz4eATFN1XtVpWMb_RYGQIFg
[Trace] CISBaseBot.CISBaseBot: Operation returned an invalid status code 'Unauthorized'
[Debug] Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLIRTMBEP9BP" completed keep alive response.
Hugely appreciate any help in advance... based on my reading it appears to be an expired token but I have been unable to find how to refresh the token in the V4 SDK.