Thursday, October 11, 2018

CentOS + MS Bot Framework: Solving error "ChatConnector: receive - invalid token"

When I deploy my chat bot written with MS Bot Framework on CentOS, I got the error "ERROR: ChatConnector: receive - invalid token. Check bot's app ID & Password", although I provide exactly my bot's app ID & Password.


After googling, I know the problem is server time not corrected (in my case, it is late ~ 20 minutes), so the security token is invalid.

You can solve this easily by syncing your server time with a standard NTP (Network Time Protocol) server. Below are steps.

1. Install ntp and ntpdate
# yum install ntp ntpdate
2. Enable ntpd service
# systemctl start ntpd
# systemctl enable ntpd
Check its status:
# systemctl status ntpd
3. Add some CentOS NTP servers
# ntpdate -u -s 0.centos.pool.ntp.org 1.centos.pool.ntp.org 2.centos.pool.ntp.org
4. Restart ntpd service
# systemctl restart ntpd
5. Check again
# timedatectl
# date

Addition, let set hardware clock to the current server time:
# hwclock  -w
Now you can start your bot without this error. Cheers!

1 comment:

Subscribe to RSS Feed Follow me on Twitter!