Skip to content

Commit

Permalink
Teams + SSO: Update OAuthcard channel support and return 412 instead…
Browse files Browse the repository at this point in the history
… of 409 on sso fail (#2407)

* Teams + SSO: Update OAuthcard channel support and return 412 instead of 409 on sso fail

* SSO: Update OAuthPrompt test to match new status code
  • Loading branch information
carlosscastro committed Jun 24, 2020
1 parent f3e7e02 commit 72e436b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions libraries/botbuilder-dialogs/src/prompts/oauthPrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ export class OAuthPrompt extends Dialog {

if(!tokenExchangeResponse || !tokenExchangeResponse.token) {
await context.sendActivity(this.getTokenExchangeInvokeResponse(
StatusCodes.CONFLICT,
StatusCodes.PRECONDITION_FAILED,
'The bot is unable to exchange token. Proceed with regular login.'));
} else {
await context.sendActivity(this.getTokenExchangeInvokeResponse(StatusCodes.OK, null, context.activity.value.id));
Expand Down Expand Up @@ -492,7 +492,6 @@ export class OAuthPrompt extends Dialog {

private channelSupportsOAuthCard(channelId: string): boolean {
switch (channelId) {
case Channels.Msteams:
case Channels.Cortana:
case Channels.Skype:
case Channels.Skypeforbusiness:
Expand Down
2 changes: 1 addition & 1 deletion libraries/botbuilder-dialogs/tests/oauthPrompt.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ describe('OAuthPrompt', function() {
.assertReply(a => {
assert.strictEqual('invokeResponse', a.type);
assert(a.value);
assert.strictEqual(a.value.status, 409);
assert.strictEqual(a.value.status, 412);
assert(a.value.body.failureDetail);
});
});
Expand Down
1 change: 1 addition & 0 deletions libraries/botframework-schema/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1928,6 +1928,7 @@ export enum StatusCodes {
NOT_FOUND = 404,
METHOD_NOT_ALLOWED = 405,
CONFLICT = 409,
PRECONDITION_FAILED = 412,
UPGRADE_REQUIRED = 426,
INTERNAL_SERVER_ERROR = 500,
NOT_IMPLEMENTED = 501,
Expand Down

0 comments on commit 72e436b

Please sign in to comment.