Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add userId parameter to signOutUser #797

Closed
wants to merge 10 commits into from
7 changes: 5 additions & 2 deletions libraries/botbuilder/src/botFrameworkAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,16 @@ export class BotFrameworkAdapter extends BotAdapter implements IUserTokenProvide
* Signs the user out with the token server.
* @param context Context for the current turn of conversation with the user.
* @param connectionName Name of the auth connection to use.
* @param userId id of user to sign out.
* @returns A promise that represents the work queued to execute.
*/
public async signOutUser(context: TurnContext, connectionName: string): Promise<void> {
public async signOutUser(context: TurnContext, connectionName?: string, userId?: string): Promise<void> {
if (!context.activity.from || !context.activity.from.id) {
throw new Error(`BotFrameworkAdapter.signOutUser(): missing from or from.id`);
}
!userId? userId = context.activity.from.id: userId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you do this using a less weird syntax? This makes my head hurt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!


this.checkEmulatingOAuthCards(context);
const userId: string = context.activity.from.id;
const url: string = this.oauthApiUrl(context);
const client: TokenApiClient = this.createTokenApiClient(url);
await client.userToken.signOut(userId, { connectionName: connectionName, channelId: context.activity.channelId } );
Expand Down