When you deploy the puppet-official-account in cluster server, and it will kill and start a docker in a new host. So, the ip address will change, and it can fetch accessToken from tencent server. Because the tencent server require the ip address of the request must be in their white ip address which you can add a limited IP whitelist. But in this situation, you can't define the specific IP address. So, we should find a way to resolve it.
There is a limit for getAccessToken method that the ip address of the request must be in their white ip address.
Solution
We can configure the accessTokenProxyUrl to fetch accessToken from a fix endpoint, which has a fix ip address. So, it will fix the above problem in a simple way.
Situation
When you deploy the
puppet-official-account
in cluster server, and it will kill and start a docker in a new host. So, the ip address will change, and it can fetchaccessToken
from tencent server. Because the tencent server require the ip address of the request must be in their white ip address which you can add a limited IP whitelist. But in this situation, you can't define the specific IP address. So, we should find a way to resolve it.limitation
There is a limit for
getAccessToken
method that the ip address of the request must be in their white ip address.Solution
We can configure the
accessTokenProxyUrl
to fetchaccessToken
from a fix endpoint, which has a fix ip address. So, it will fix the above problem in a simple way.Usage
1. set envrioment or configuration
or
2. create your accessTokenProxyServer
You can create your
AccessTokenProxyServer
to help you fetch the accessToken and return it back to you.The final
getAccessToken
action will request:http://your-endpoint/token?grant_type=client_credential&appid=${appId}&secret=${appSecret}
.If you don't want to create your
AccessTokenProxyServer
, you can use the support docker to deploy your service: https://github.com/wj-Mcat/official-account-access-token-center