How to get the signin URL for the "signin" activity type in Azure Bot Service?

Gabriel St-Pierre 0 Reputation points
2023-12-11T19:50:17.5133333+00:00

We are not using the Bot Framework SDK and need to get the "signin" URL for user authentication but are unsure how. We have set up an Auth provider in the "Add OAuth connection settings" of the Azure Bot Service resource. Can someone please provide guidance on how to obtain the URL? Is it dynamic or static, and why isn't it shown on the Azure Bot configuration page? We need to use plain HTTP requests as the SDK is not available in our server programming language.

I can see that when using the Bot Framework SDK we only need to provide the Name of the OAuth Provider that has been configured in the "Add OAuth connection settings" section. How can we derive the "signin" action value (url) from that connection name alone?

Azure AI Bot Service
Azure AI Bot Service
An Azure service that provides an integrated environment for bot development.
747 questions
Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
9,077 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,847 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,879 questions
{count} votes

2 answers

Sort by: Most helpful
  1. YutongTie-MSFT 46,646 Reputation points
    2023-12-13T01:04:54.0033333+00:00

    @Gabriel St-Pierre Thanks for reaching out to us. It seems the issue may be related to the OAuth callback process. It's not just about opening the sign-in page, but also about handling the callback correctly.

    The typical OAuth flow with Azure Bot Framework is as follows:

    1. The bot sends a sign-in card to the user.
    2. The user clicks the sign-in button, which directs them to the OAuth provider's sign-in page.
    3. After the user signs in, the OAuth provider redirects the user to a callback URL.
    4. The Bot Framework's OAuth service receives the callback, creates a token, and sends a message (known as the token response) to the bot.

    The "https://token.botframework.com/.auth/web/redirect" URL you're using as the redirect_uri is the callback URL for the Bot Framework's OAuth service. This URL is where the OAuth provider sends the authorization code after the user signs in.

    If the authentication popup opens to the right page but nothing happens after that, it means that the OAuth provider isn't able to send the authorization code to the Bot Framework's OAuth service. This could be due to a misconfiguration in your OAuth settings.

    Here are a few things you can have a try -

    1. Make sure that the "https://token.botframework.com/.auth/web/redirect" URL is registered as the callback URL/redirect URI in your OAuth provider's settings.
    2. Check your OAuth connection settings in Azure Bot Service to make sure that the client ID, client secret, and scopes are correctly set.
    3. Verify that the Authorization URL and Token URL in your OAuth connection settings are correct.
    4. If you're using a custom OAuth provider, make sure that it supports the authorization code grant type, which is required for the OAuth flow used by Azure Bot Service.

    If everything is correctly set up, the OAuth provider should be able to redirect the user to the Bot Framework's OAuth service after sign-in, and the OAuth service should be able to send a token response to your bot.

    Please let us know how it works.

    Regards,

    Yutong