diff --git a/packages/apps/src/app.oauth.ts b/packages/apps/src/app.oauth.ts index 969a59dbe..be4eb6740 100644 --- a/packages/apps/src/app.oauth.ts +++ b/packages/apps/src/app.oauth.ts @@ -15,8 +15,7 @@ export async function onTokenExchange( this: App, ctx: contexts.IActivityContext ) { - const { api, activity, log } = ctx; - + const { api, activity, log, next } = ctx; if (this.oauth.defaultConnectionName !== activity.value.connectionName) { log.warn( `default connection name "${this.oauth.defaultConnectionName}" does not match activity connection name "${activity.value.connectionName}"` @@ -40,6 +39,10 @@ export async function onTokenExchange( ); this.events.emit('signin', { ...ctx, token, isSignedIn: true }); + const nextResult = await next(); + if (nextResult && nextResult.status !== 200) { + log.warn('Expecting token exchange to return 200, but got:', nextResult.status); + } return { status: 200 }; } catch (error) { if (error instanceof AxiosError) { @@ -64,8 +67,7 @@ export async function onVerifyState( this: App, ctx: contexts.IActivityContext ) { - const { log, api, activity } = ctx; - + const { log, api, activity, next } = ctx; try { if (!activity.value.state) { log.warn( @@ -88,6 +90,10 @@ export async function onVerifyState( ); this.events.emit('signin', { ...ctx, token, isSignedIn: true }); + const nextResult = await next(); + if (nextResult && nextResult.status !== 200) { + log.warn('Expecting verify-state to return 200, but got:', nextResult.status); + } return { status: 200 }; } catch (error) { if (error instanceof AxiosError) {