Reputation: 1499
I used the botbuilder-js to write a custom bot. At some point it requires the user to sign in, so the bot sends out the OAuthPrompt
dialog, which makes user sign in (with google, which I have configured in Azure Portal OAuth Connection Settings). It works fine in the Bot Framework Emulator, but when I integrate the bot with Cortana, after the user signs in, he lands on this page:
The fun part is that this dialog is modal, so I cannot paste the code in the Cortana chat even if I wanted to.
What do I need to do to force Cortana to not require this magic code?
Upvotes: 0
Views: 216
Reputation: 903
Following the instructions on Google, I discovered that the redirect URL is why you are prompted for a magic code. If you use Google tools, and you set up for out-of-band auth, you will get an OAuth authorization URL that looks like this...
Authorize this app by visiting this url:
https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata.readonly&response_type=code&client_id=[my client id]&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob
Enter the code from that page here: [your code]
You shouldn't set up for out of band auth (aka copy/paste auth urn:ietf:wg:oauth:2.0:oob
) - because it means that the identity manager is not calling the redirect_url (or redirect_uri) when the flow completes (letting bot service or cortana know that you're done signing in), and more important, you probably don't want the user to paste in some code to get the access token. If you follow https://developers.google.com/identity/protocols/OAuth2InstalledApp you will see the redirect uri should be either bot frameworks, or cortanas, not out of band. Do this, and the code should get ingested programmaticly by the requestor. You can configure this in the Google app reg clicking the credentials blade.
Upvotes: 0
Reputation: 6383
Already answered this on the GitHub botbuilder-js repo. Answering for greater visibility.
It does appear to be a bug. I was able to repro the issue. If you copy the code down you can enter the code as a new command to the bot. It's a terrible work around, but it will work until the UI is fixed. Follow these steps:
Upvotes: 0