MS Teams Bot oAuthPrompt, how to change popup size

Viewed 133

I would like to know how to control the size of the popup of a ms-teams oauthPrompt.

I'm writing a Teams bot that includes sso to my application.

I followed the examples such as '46.teams-auth', and have two services running: ms-teams-bot, auth-service

AddDialog(new OAuthPrompt(
  nameof(OAuthPrompt),
    new OAuthPromptSettings
      {
        ConnectionName = ConnectionName,
        Text = "Please Sign In",
        Title = "Sign In",
        Timeout = 300000, // User has 5 minutes to login (1000 * 60 * 5)
      }));

Everything is working except I don't know how to control the size of the popup that opens once I click the sign in button in the oAuthPrompt.

I found this article that notes I can add width/height to the URL to control the popup size, but I don't understand which URL they are referring to. I have set the URL to my auth-service on Azure on the 'Service Provider Connection Setting ', adding width/size to this doesn't affect the popup size, and the URL of the 'Sign In' button is not controlled by me.

1 Answers

You need pass width and height query string parameters in the URL. Please see the below code.

microsoftTeams.authentication.authenticate({
    url: window.location.origin + "/tab-auth/simple-start",
    width: 600,
    height: 535,
    successCallback: function (result) {
        getUserProfile(result.accessToken);
    },
    failureCallback: function (reason) {
        handleAuthError(reason);
    }
});
Related