botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

POST refresh access token failed with status code: 400

Open khakiali opened this issue 9 years ago • 42 comments

Thanks for creating the framework! I am trying to follow this and create the generic bot, but am having issues trying to get the emulator recognize my bot. I have attached the webconfig and error message shown by the emulator. emuerror webconfig

khakiali avatar Dec 31 '16 18:12 khakiali

Hi @khakiali, Sorry you're having this problem. Please check your computer's date and time settings. Our authentication scheme requires these to be accurate to within five minutes.

eanders-ms avatar Dec 31 '16 21:12 eanders-ms

Hi Eric, Thanks for the reply. However i do not think that is the root cause. My date/time is aligned with the authentication. please see attached. emuerrordatetime

khakiali avatar Jan 01 '17 05:01 khakiali

apologies did not mean to close issue :).

khakiali avatar Jan 01 '17 05:01 khakiali

its ok - i managed to resolve it. I was using an older version of the template, this conflicted with the new version of the bot!

khakiali avatar Jan 01 '17 23:01 khakiali

Hi can you please shed some light on what you meant by older version of the template?

NotTooReact89 avatar Jan 16 '17 06:01 NotTooReact89

Hi, I was using an earlier version of the SDK which had an older version of the web.config file. The appears to have authentication between that and the emulator. A good way to tell whether you have an older version is that the new version has MicrosoftAppID and MicrosoftAppPassword keys instead of just simply appid and app password keys within the appsettings of the web.config file,

khakiali avatar Jan 17 '17 03:01 khakiali

@khakiali Same problem here. How did you solve it?

jorge-sanz avatar Jan 18 '17 12:01 jorge-sanz

Same here. Bumping.

felipeq avatar Jan 20 '17 22:01 felipeq

Guys check this - https://docs.botframework.com/en-us/support/troubleshooting-bot-framework-authentication/ . I had the same issue. Following the steps in this url fixed it.

saurabhabh avatar Feb 02 '17 02:02 saurabhabh

When you use localhost you don't need to specify the credentials in the emulator and in the code too. Credentials come to use when you deploy it to Azure.

NotTooReact89 avatar Feb 11 '17 19:02 NotTooReact89

@saurabhabh that link is dead for me.

I am having a similar issue using the bot on azure running through the emulator. It works without credentials, but not with the credentials (in the emulator). Have MicrosoftAppId and MicrosoftAppPassword set in the web.config and have taken the id and password from the application registration portal. Wanting to get it working through webchat, but at this point can't even see it in the emulator.

McGern avatar Feb 17 '17 18:02 McGern

I think you need to publish your bot so as it could make use of the credentials. For the local emulator which is just for testing you don't need credentials.

saurabhabh avatar Feb 17 '17 18:02 saurabhabh

For testing with directline etc, you need an app id and password. This is before the bot is published.

McGern avatar Feb 20 '17 13:02 McGern

@McGern: here's the correct link.. https://docs.microsoft.com/en-us/bot-framework/troubleshoot-authentication-problems. I guess you must have solved your issue by now anyways.

adekola avatar May 31 '17 09:05 adekola

Thanks for the link.

Think I ended up having to remove something in that was in the register method of the bot. It was bypassing the builtin authentication somehow and needed to do it manually (that led to a host of other issues). I am not sure if what I have is right but it seems to work for now.

McGern avatar Jun 01 '17 16:06 McGern

Is anyone else experiencing this problem now, out of the blue? I have a bot running, and have had it running, for months with no issues. It's using botbuilder 3.6.0, and there have been no changes to the code that would cause this. In the morning it was working, and suddenly it started throwing this error about refresh access token failed with status code 400. Is anyone else seeing this, or does anyone have any thoughts? Troubleshooting the authentication problem hasn't helped me. My ID and PWD are correct (I didn't change them anyway).

lchinitz avatar Jul 25 '17 19:07 lchinitz

Up, same here. Happened with no reason today killing all my bots running for weeks without issues.

Tried so far:

  • Regenerating appId and appPassword
  • Updating botbuilder node package

Nope, I'm using 3.8.4 already released 2 months ago https://www.npmjs.com/package/botbuilder

Tomasz-Silpion avatar Jul 25 '17 19:07 Tomasz-Silpion

Same here. [Tue Jul 25 2017 15:18:13 GMT-0400 (EDT)] ERROR Error: Refresh access token failed with status code: 400

joshftx avatar Jul 25 '17 19:07 joshftx

Also having this issue, since about 30 mins ago. Tried

  • regenerating appId and appPassword
  • creating new bot and using that one's appId and appPassword
  • updating node packages

isabelacmor avatar Jul 25 '17 19:07 isabelacmor

same here on 3.8.4. Worked yesterday...

nsantini avatar Jul 25 '17 19:07 nsantini