Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Issue with authentification #34

Open
souuuf opened this issue Aug 11, 2017 · 0 comments
Open

Issue with authentification #34

souuuf opened this issue Aug 11, 2017 · 0 comments

Comments

@souuuf
Copy link

souuuf commented Aug 11, 2017

Hello,

In my Bot project. i need to check that the user is connected in every task related to an intent.

i am using LUIS, and AuthBot V2

my problem is that the login message fire only in one task. when i say HELLO.

by in another intent "HELP", the login message doesn't fire.

here is my code & result :

 public class RootDialog : LuisDialog<object>
    {
        [LuisIntent("Help")]
        public async Task Help(IDialogContext context, IAwaitable<IMessageActivity> activity, LuisResult result)
        {
            var message = await activity;
            //CheckLogin
            if (string.IsNullOrEmpty(await context.GetAccessToken(AuthSettings.Scopes)))
            {
                await context.Forward(new AzureAuthDialog(AuthSettings.Scopes), this.ResumeAfterAuth, message, CancellationToken.None);
            }
            else
            {
                await context.PostAsync($"hi " + getUser(context).UserName);
                context.Wait(this.MessageReceived);
            }
        }

        [LuisIntent("Welcome")]
        public async Task Welcome(IDialogContext context, IAwaitable<IMessageActivity> activity, LuisResult result)
        {
            var message = await activity;
            //CheckLogin
            if (string.IsNullOrEmpty(await context.GetAccessToken(AuthSettings.Scopes)))
            {
                await context.Forward(new AzureAuthDialog(AuthSettings.Scopes), this.ResumeAfterAuth, message, CancellationToken.None);
            }
            else
            {
                await context.PostAsync($"Hi " + getUser(context).UserName);
                context.Wait(this.MessageReceived);
            }
        }
}

And here is the result :

image

Can you please help me getting this work.

thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant