No response when OAuthPrompt Dialog is used in Teams bot
I am trying to use OAuthPrompt in teams bot for the user to sign in (SSO), and fetch the access JWT token so that I can use it to impersonate him/her in my Teams Bot. The App configurations and the Bot have been configured as per the following link exactly.
this.addDialog(new OAuthPrompt(OAUTH_PROMPT, {
connectionName: process.env.connectionName,
text: 'Please Sign In',
title: 'Sign In',
timeout: 60000
}));
async SSOLogin(stepContext){
try {
return await stepContext.beginDialog(OAUTH_PROMPT);
} catch (err) {
logger.error({error:err,msg:"SSOLogin was error"});
}
}
//login sso
this.addDialog(new WaterfallDialog(LOGIN_TOKEN_DIALOG,[
this.SSOLogin.bind(this),
this.loginStep.bind(this),
]));
async loginStep(stepContext) {
// Get the token from the previous step. Note that we could also have gotten the
// token directly from the prompt itself. There is an example of this in the next method.
const tokenResponse = stepContext.result;
if (!tokenResponse || !tokenResponse.token) {
logger.error({msg:`microsoft sso login have not return result,tokenResponse or tokenResponse.token is null`,tokenResponse:tokenResponse})
await stepContext.context.sendActivity("We're sorry, there's an issue with logging in using your Microsoft account. Please wait a few minutes and try again.");
return await stepContext.beginDialog(MAIN_WATERFALL_DIALOG);
} else {
try{
const userProfile=await this.userProfile.get(stepContext.context,{});
const client = new SimpleGraphClient(tokenResponse.token);
if(!userProfile.mail){
const me = await client.getMe();
userProfile.email=me.mail;
userProfile.displayName=me.displayName;
//print graph user info
logger.info({MicrosoftEmail:`${me.mail}`, MicrosoftName:`${me.displayName}`,graphInfo:me,msg:"Successfully get Microsoft user profile"});
}
Since the end of September 2024, it’s found that this “continue” button no longer prompted. No code change has been made from my side.
Since there is no response, the request is finally timeout.
In the past (around early September), the “Continue” button would appear in the Teams Client, but it is no longer displayed now
The SSO still functions perfectly in “Test in Web Chat” from Azure portal today (14th Oct 2024).
I tested the bot in Classic Teams yesterday (on 13rd Oct 2024) (which is not supported anymore), the "Continue" button can be displayed and functions well. I got the token to login successfully.
What have I checked already:
I have added token.botframework.com, and graph.microsoft.com to the valid Domains list (Manifest file), as I read them on various support articles.
I referred to the documentation at Microsoft Learn and triple-checked my App Registrations and configurations to ensure they were set up correctly.