oauthcortanacortana-skills-kitcortana-invoke

Cortana Skill authentication on invocation not working


I have a fully working Cortana Skill, and I tried to include Oauth authentication by following this link:

Configure authentication for Microsoft's identity server

But it's not working, it's just not showing anything and allowing the user to use the skill with no authentication. Besides the configuration in the link above, is there any code that I need to implement in the bot service? I would appreciate your help.

Thanks!

Update 1

This is how I've setup the Cortana Oauth details, right now using the example from the Microsoft article:

Cortana Oauth setup

As far as I understand, nothing else should be done in code for the login request to show up, only the piece of code to retrieve the auth token, but nothing shows up, the Skill starts to run right away.

I've tried using authentication with GetTokenDialog and SendOAuthCardAsync and it works, however by the time that I receive the confirmation code to finish the authentication, if I say it to Cortana, "she" does not recognize the code, and if I type it instead, it works but Cortana stops talking.

I also followed this video, and it's exactly what I've done:

Build 2017 Authentication in Cortana Skills

Do I need to update the botBuilder SDK or something? I'm at 3.15.2.2. I just never get the login prompt. Thanks!

SOLUTION

It turns to be a Microsoft bug; since everything was ok, I decided to delete the Cortana channel and re-create it from scratch and now the login prompt is showing up, thanks!


Solution

  • Bot oauth and cortana oauth work slightly different.

    First, make sure you have turned on "Cortana should manage my user's identity" on the Cortana channel configuration via azure portal or botframework. Then fill in all the fields (we are updating the website doc immanently because it is incorrect). Don't select "Sign in when required" unless you send an OAuth card before your resource call.

    Then when you invoke your skill the OAuth dialog should be shown. If it isn't, don't forget Cortana will cache your auth token if you successfully logged in once. You can clear the token by disconnecting the skill via the Cortana notebook.

    I have samples in node and c#. https://github.com/bw-kforce-ms/CortanaSkillsWIP/tree/master/Consumer/Node/OAuth2Example