Unable to get a Bot Token for a non-published App

Michael Karampalas 5 Reputation points
2024-04-29T22:16:49.8966667+00:00

Hi there,

We are developing a new Bot for notifications from our website.

We are using the Proactive Installation flow. The flow works when we use our old, published App, but when I switch to the App we are building, which is published to our org, I get error below.

If I switch to the Bot id and secret of our published app, everything works fine, the App is installed for the User and I can get a conversation_id .

Any ideas?

Thank you very much.

Request to: https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token


{
  "error"=>"unauthorized_client",
  "error_description"=>"AADSTS700016: Application with identifier '205ed844-0739-4830-a8b8-4b3be06a4845' was not found in the directory 'Bot Framework'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant. Trace ID: f4c80488-d166-41a5-a3af-14c5a0131900 Correlation ID: 6ed56390-d871-4e9e-bd26-18a95ea75484 Timestamp: 2024-04-29 21: 57: 57Z",
  "error_codes"=>[
    700016
  ],
  "timestamp"=>"2024-04-29 21: 57: 57Z",
  "trace_id"=>"f4c80488-d166-41a5-a3af-14c5a0131900",
  "correlation_id"=>"6ed56390-d871-4e9e-bd26-18a95ea75484",
  "error_uri"=>"https: //login.microsoftonline.com/error?code=700016"
}


Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,795 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,455 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. hossein jalilian 4,040 Reputation points
    2024-04-30T01:50:32.47+00:00

    Hello Michael Karampalas,

    Thanks for posting your question in the Microsoft Q&A forum.

    Please ensure that the application is properly registered in the correct Azure AD tenant, has been either installed by an administrator or consented to by a user in the correct tenant, and double-check that you are using the correct tenant ID in your code or configuration.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful


  2. Michael Karampalas 5 Reputation points
    2024-05-07T16:03:10.7466667+00:00

    I was able to get this working by adding an OAuth Connection Setting.

    https://portal.azure.com/ -> Bot Services -> {Bot name}

    In the side menu: Settings -> Configuration

    At the bottom of the page click Add OAuth Connection Settings.

    Choose Azure Active Directory

    Enter the client_id and client_secret from the App Registration that the Bot is using.

    User's image

    0 comments No comments