Esempio n. 1
0
        public static Task <TokenResponse> GetUserTokenAsync(this IDialogContext context, string connectionName, string magicCode)
        {
            var userId = context.Activity.From.Id;
            IConnectorClientFactory factory = new ConnectorClientFactory(Address.FromActivity(context.Activity), new MicrosoftAppCredentials());

            return(factory.MakeOAuthClient().OAuthApi.GetUserTokenAsync(userId, connectionName, magicCode));
        }
Esempio n. 2
0
        public static Task <bool> SignOutUserAsync(this IDialogContext context, string connectionName)
        {
            var userId = context.Activity.From.Id;
            IConnectorClientFactory factory = new ConnectorClientFactory(Address.FromActivity(context.Activity), new MicrosoftAppCredentials());

            return(factory.MakeOAuthClient().OAuthApi.SignOutUserAsync(userId, connectionName));
        }
Esempio n. 3
0
        public static Task <TokenResponse> GetUserTokenAsync(this IDialogContext context, string connectionName)
        {
            var channelId = context.Activity.Conversation.Id;
            var userId    = context.Activity.From.Id;
            IConnectorClientFactory factory = new ConnectorClientFactory(Address.FromActivity(context.Activity), new MicrosoftAppCredentials());

            return(factory.MakeOAuthClient().GetOAuthApiEx().GetUserTokenAsync(channelId, userId, connectionName, null, default(CancellationToken)));
        }
Esempio n. 4
0
        public static Task <string> GetSignInUrlAsync(this IDialogContext context, string connectionName)
        {
            IConnectorClientFactory factory = new ConnectorClientFactory(Address.FromActivity(context.Activity), new MicrosoftAppCredentials());

            return(factory.MakeOAuthClient().OAuthApi.GetSignInLinkAsync(context.Activity, connectionName));
        }