Ich bin ein Facebook-Login-Dialog in C# mit dem Botframework, aber nach dem Erhalt der Zugriffstoken, wird es nicht weiter die Konversation normalerweise ich verstehe nicht warum. Ich verfolge dieses Beispiel: https://github.com/Microsoft/BotBuilder/tree/master/CSharp/Samples/SimpleFacebookAuthBot Aber ich kann nicht mein Gespräch wieder aufzunehmen, und ich erhalte diese Ausnahme:Konversation wird nicht fortgesetzt Bot-Framework
System.InvalidOperationException
Nachricht: Der Betrieb aufgrund des aktuellen Status des Objekts nicht gültig ist.
Es tritt auf, wenn ich das Gespräch fortsetzen möchte.
[HttpGet]
[Route("api/OAuthCallback")]
public async Task<HttpResponseMessage> OAuthCallback([FromUri] string userId, [FromUri] string botId, [FromUri] string conversationId, [FromUri] string channelId, [FromUri] string serviceUrl, [FromUri] string locale, [FromUri] string code, [FromUri] string state, CancellationToken token)
{
// Get the resumption cookie
var address = new Address
(
botId: FacebookHelper.TokenDecoder(botId),
channelId: channelId,
userId: FacebookHelper.TokenDecoder(userId),
conversationId: FacebookHelper.TokenDecoder(conversationId),
serviceUrl: FacebookHelper.TokenDecoder(serviceUrl)
);
var resumptionCookie = new ResumptionCookie(address, userName: null, isGroup: false, locale: locale);
var accessToken = await FacebookHelper.ExchangeCodeForAccessToken(resumptionCookie, code, FacebookAuthDialog.FacebookOauthCallback.ToString());
// Create the message that is send to conversation to resume the login flow
var msg = resumptionCookie.GetMessage();
msg.Text = $"token:{accessToken.AccessToken}";
// Resume the conversation to FacebookAuthDialog
//, wo ich die AUSNAHME GET
erwarten Conversation.ResumeAsync (resumptionCookie, msg);
using (var scope = DialogModule.BeginLifetimeScope(Conversation.Container, msg))
{
var dataBag = scope.Resolve<IBotData>();
await dataBag.LoadAsync(token);
ResumptionCookie pending;
if (dataBag.PrivateConversationData.TryGetValue("persistedCookie", out pending))
{
// remove persisted cookie
dataBag.PrivateConversationData.RemoveValue("persistedCookie");
await dataBag.FlushAsync(token);
return Request.CreateResponse("You are now logged in! Continue talking to the bot.");
}
else
{
// Callback is called with no pending message as a result the login flow cannot be resumed.
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, new InvalidOperationException("Cannot resume!"));
}
}
}
danke, ich werde es versuchen. –
Bitte markieren Sie diese als beantwortet. –
ok ich denke es ist fertig –