After following the guide on using the OAuthPrompt dialog from botbuilder-dialogsand it seems like all requests related to retrieving the user token for a connection are failing with a status code of 401, thus the prompt never makes it past the stage of trying to check if we have a token before starting the dialog prompt for the oauth connection.
I have properly configured appId and appPassword and am able to successfully use other api methods like getActivityMembers from the BotFrameworkAdapter adapter instance. However I noticed that when the SDK tries to make the request to check if we have a token for a user/connection it does not send any authorization header, thus it makes sense that the request fails with a 401 status code.
Here is the full error message + stack trace:
{ Error
at new RestError (/Users/agonbina/Gameon/bot/node_modules/ms-rest-js/lib/restError.ts:13:5)
at OAuthApiClient.<anonymous> (/Users/agonbina/Gameon/bot/node_modules/botframework-connector/src/oAuthApiClient.ts:83:21)
at Generator.next (<anonymous>)
at fulfilled (/Users/agonbina/Gameon/bot/node_modules/botframework-connector/lib/oAuthApiClient.js:11:58)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:118:7)
code: undefined,
statusCode: 401,
request:
{ headers:
{ 'Content-Type': 'application/json; charset=utf-8',
'User-Agent': 'Node/v9.10.1 (x64-Darwin-16.7.0) ms-rest-js/0.1.0 botframework-connector/4.0.0 Microsoft-BotFramework/3.1 (BotBuilder JS/4.0.0-preview1.2) Azure-SDK-For-Node',
cookie: '' },
rawResponse: false,
url: 'https://api.botframework.com/api/usertoken/GetToken?userId=default-user&connectionName=Facebook',
method: 'GET' },
response:
{ body:
PassThrough {
_readableState: [ReadableState],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 4,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: true,
_transformState: [Object] },
headers: Headers { _headers: [Object] },
status: 401 },
body: undefined }
Happy to provide more information if necessary, otherwise this should be simple to re-produce by following the example provided in the docs for OAuthPrompt.
Sorry for the delay. We will look into this. @Jeffders any thoughts?
@Stevenic any updates?
Steve and I just pushed some fixes. Give it a try now.
I just fetched form repo and run the oauth sample with the same error mentioned from @agonbina . Really need some help on this. we tried azure b2c without success and the same with directly addressing facebook login as provider. would love to use azure b2c but no luck on setting it up.
@tschnoelzer same here, I tried pulling the repo and installing the npm packages from the pulled local folder but the issue does not seem to be fixed. It seems like the release process for this project is kinda messy right now. I am also not sure why the built source(javascript files) are versioned given that most of the codebase seems to be written in Typescript :)
So @Jeffders and @Stevenic pls reopen ... we have really problems in implementations for a new project ... it is really easy to test ... with preview 1.2 no sample implementation is working as the rest http error always occurs.
The samples work fine if you use symbolic links to what's actually in the SDK instead of that preview version. I believe Steve is going to do a pass through all of the botbuilder packages in the packages.json, but for now, just create symbolic links to what is in the SDK or use the latest SDK releases.
I can not get the token back when using AAD B2C. So the code here
session.send("Let's see if that code works...");
adapter.getUserToken(session.message.address, connectionName, session.message.text, (err2, tokenResponse) => {
if (tokenResponse) {
session.send('It worked! You are now signed in with token: ' + tokenResponse.token);
session.userData.activeSignIn = false;
} else {
session.send("Hmm, that code wasn't right");
}
});
delivers a tokenResponse only with connectionName. No token. I have openId, BotLogin and user_impersonation in my scopes ( Portal: settings / Authentication ). Is there a problem with B2C and BOT? please feedback as we have to switch to another identity provider in that case. What configuration is correct?
Thanks for any clue!
Timo
What is connection name? Is that like provider names? like "aadv2"
debugging the method getUserToken line 402 oAuthApiClient.ts the connection Name is correct iwth "CmbAuth$" in my case.
the Method getUserTokenWithHttpOperationResponse(userId, connectionName, magicCode, options) has undefined options which set the header. In my case just calling GET on https://api.botframework.com/api/usertoken/GetToken?userId=default-user&connectionName=CmbAuth$
so to all facing that problem: I could easily get it running now by changing mit package.json reference from version 1.2preview to a file link of the latest code in repo. Just the way @Jeffders already suggested.
I used just file links will dig into handling symlinks later.
"dependencies": {
"botbuilder": "file:/Users/tschnoelzer/Documents/development/CmbEnterprise/projects/comboo-pack/botbuilder-js/libraries/botbuilder",
"botbuilder-dialogs": "file:/Users/tschnoelzer/Documents/development/CmbEnterprise/projects/comboo-pack/botbuilder-js/libraries/botbuilder-dialogs",
"botframework-connector": "file:/Users/tschnoelzer/Documents/development/CmbEnterprise/projects/comboo-pack/botbuilder-js/libraries/botframework-connector",
"botbuilder-prompts": "file:/Users/tschnoelzer/Documents/development/CmbEnterprise/projects/comboo-pack/botbuilder-js/libraries/botbuilder-prompts",
"botbuilder-core": "file:/Users/tschnoelzer/Documents/development/CmbEnterprise/projects/comboo-pack/botbuilder-js/libraries/botbuilder-core",
"botbuilder-core-extensions": "file:/Users/tschnoelzer/Documents/development/CmbEnterprise/projects/comboo-pack/botbuilder-js/libraries/botbuilder-core-extensions",
Hi, @tschnoelzer
any update?
I cant solve this problem.
@Stevenic @Jeffders will there be a new preview release soon? In order to fix this issue with the current published preview version (1.2). Afaik it isn't possible to point directly to the Github master branch from the package.json due to our Lerna structure. Local file pointers are fine, however when you are trying to publish it on Azure it is quite a hassle.
also waiting for an update on github ...
There is a workaround posted on github.
https://github.com/Microsoft/BotBuilder/issues/4768
On Thu, Aug 2, 2018 at 7:21 AM Timo Schnoelzer notifications@github.com
wrote:
also waiting for an update on github ...
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/botbuilder-js/issues/231#issuecomment-409893379,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AbWhNpcth71UMB-fy6hp2MJKlk9uFjIuks5uMuCcgaJpZM4T6c20
.>
Thanks,
Jignesh Patel