Search code examples
phpbotframeworkbotconnector

Unable to get token from Bot Framework


Since few days, I'm unable to get a token from Microsoft Bot Framework Web Chat API.

I do a GET request to https://webchat.botframework.com/api/tokens with PHP. I set the header Authorization to BotConnector MY_SECRET :

$options = array('http' => array(
    'method' => 'GET',
    'header' => 'Authorization: BotConnector ' . $secret
));

$context = stream_context_create($options);

$token = file_get_contents('https://webchat.botframework.com/api/tokens', false, $context);

The server answer is: "HTTP request failed! HTTP/1.1 405 Method Not Allowed".

My secret key is valid, I try also with a POST request but the server answers the same result.

If I call the Web Chat iFrame with my Secret Key, all works great but it's not secure.


Solution

  • This was a temporary bug/regression, I reported it and it's now fixed. The service should work as documented.

    https://github.com/Microsoft/BotBuilder/issues/1556#issuecomment-257333517