Пример #1
0
        private async Task <bool> IsAuthenticated(ITurnContext <IInvokeActivity> turnContext, CancellationToken cancellationToken)
        {
            // When the Bot Service Auth flow completes, the action.State will contain a magic code used for verification.
            var    magicCode = turnContext.GetAuthenticationStateCode();
            string authToken = await turnContext.GetUserTokenAsync(this.connectionName, magicCode, cancellationToken);

            var isAuthenticated = !string.IsNullOrEmpty(authToken);

            return(isAuthenticated);
        }