当前位置:网站首页>Enterprise wechat applet pit avoidance guide, welcome to add...
Enterprise wechat applet pit avoidance guide, welcome to add...
2022-06-11 11:12:00 【zhanyd】
Prepare to step on the pit
The company is going to develop a wechat applet for its internal staff , It happens that the company has an enterprise wechat , I boarded the enterprise wechat to have a look , It just has the function of the wechat applet .
I pat my thigh , Decided to develop a small program , Associated with the enterprise number , Okay , This decision is the beginning of everything .
A pit https
Applets only support https domain name , In fact, this is not a pit , It's just that my foot slipped into the pit .
To configure https, You must apply for a certificate first , Because the company's domain name is applied for in Alibaba cloud , So you can directly apply for a digital certificate in Alibaba cloud .
About digital certificates , Here is a very classic article , Recommend reading :What is a Digital Signature?
Because the company's primary domain name has been used for various purposes , So I want to apply for another secondary domain name , The domain name of the server specially used for making small programs .
In domain name resolution , Add a record , My secondary domain name here is :afs
For example, the primary domain name of our company is :abc123.com, So the secondary domain name of the applet is afs.abc123.com.
The secondary domain name and the company's Internet ip After binding , Then the intranet server ip And the company's Internet ip Just connect them .
Okay , Next I will apply for a certificate .
Free certificate
Enter the Alibaba cloud yundun certificate purchase page , Look at the price , Already scared to pee ...
The price , I can't do it anyway , Fortunately, there are free , Select single domain name —>DV SSL—> Free version , Finally I saw a lovely ¥0.00.
After purchase , Click sign off , Fill in the information , Fill in the column of domain name afs.abc123.com.
Be careful not to add www, I filled in the first certificate www.afs.abc123.com, As a result, the applet and the server could not be connected , This is the first pit I encountered .
Then I applied for a new one afs.abc123.com Certificate , To solve the problem .
After applying for the certificate , Follow the instructions to configure nginx Just do it , stay Nginx or Tengine Install certificate on server
Applet server domain name settings
https After the domain name is configured , Need to be in the development of small programs —> Development and setup —> Fill in the newly applied domain name in the server domain name .
such , The first level is over !
Pit two Enterprise wechat associated applet
Before use , Enterprise wechat must first be associated with an applet , Application management in enterprise wechat —> Applet —> Associate applet , Can be associated with applets .
however , The applet must be published before it can be associated .
however , The applet must first be associated with enterprise wechat , To call the enterprise wechat API test !
No test , How dare you release a small program ?
No release , I can't measure it !
It seems to have entered a dead circle ...
No matter the , Release before test , I'm afraid that my little brother and sister will not pass the examination , I'm in the notes , Specifically explained .
result , Less than an hour , The audit is over , Woo hoo .
Pit three Enterprises id
After applet release , Call get access_token The interface of 
result , Keep making mistakes ,“errcode”:40001,“errmsg”:“invalid credential”
Checked the , be supposed to sceret Parameter error 
I compared them for a long time corpsecret, The result is the same , What's wrong ?
It's not corpsecret In the wrong , It is corpid It's wrong ,corpid Is the enterprise id, No AgentId... stay ” My business “ in , There is a business id, Just fill it in !
I admit that , This is my carelessness , I don't blame enterprise wechat ...
Pit four Enterprise applet plug-ins and wx.qy.login
I'm calling code2Session Interface to get the user userid When , Always hint "errcode":40029,“errmsg”:“invalid code”
Check yes code illegal 
Why is it illegal ?
I searched the Internet for a long time , Finally found , The login interface I set is wrong , I always use wx.login call , stay When logging in to enterprise wechat, you need to use wx.qy.login Interface .
also , When debugging the developer tools , You need to switch to the enterprise wechat applet mode .
without , You need to add... In the set simulator plug-in :

The above problems have been corrected , Finally login succeeded !
It's not easy ...
Pit five You must use enterprise wechat to open the applet
In wechat , Drop down search applet , It's no use opening the applet directly , The applet can only be used normally after it is opened in the enterprise wechat . however , This also ensures security , Only those who join the enterprise wechat can use it normally .
Postscript
Because this small program needs to upload videos and pictures , When it comes to testing , Found that the picture was uploaded successfully , The video was not uploaded successfully , I found it and reported it 413 Request Entity Too Large Error of .
This is nginx The limitation of , Uploading too large files is not allowed , I'll just turn it up .
open nginx Master profile nginx.conf, Generally in /usr/local/nginx/conf/nginx.conf This position , find http{} Paragraph and add the following :
client_max_body_size 100m;
And then restart nginx Problem solving .
I walked all the way down , Hit so many holes , It took a long time to fill in , So I made a special note , Let me give you a reference .
If you encounter other pits , Welcome to add in the message , Maybe it can save a lot of time for others to step on the pit .

边栏推荐
- C language course design topic
- Can't you be free without wealth?
- Want to be iron man? It is said that many big men use it to get started
- Display of receiving address list 【 project mall 】
- Report on various activity plans of safety month 2022 (28 pages)
- 杰理之获取 BLE 出现电压检测、ADC 检测不准【篇】
- 使用pydub修改wav文件的比特率,报错:C:\ProgramData\Anaconda3\lib\site-packages\pydub\utils.py:170: RuntimeWarning:
- 封装组件系列-(一)-插槽及动态组件
- MWC 2022 lights up the future, and everything serves
- 使用Yolov3训练自己制作数据集,快速上手
猜你喜欢

Typeerror: argument of type "Int 'is not Iterable

想做钢铁侠?听说很多大佬都是用它入门的

IIHS tsp+ annual safety list released: 7 EVs were selected, and there are common problems in pedestrian AEB

Appearance mode -- it has been used in various packages for a long time!

Use yolov5 to train your own data set and get started quickly

985 University doctors became popular because of their thanks in classical Chinese! The tutor commented that he not only wrote well in sci
![Electron desktop development (development of an alarm clock [End])](/img/2b/dd59ebc8d11bedfc53020d69f1aa69.png)
Electron desktop development (development of an alarm clock [End])

Introduction to thread pool: ThreadPoolExecutor

封装组件系列-(一)-插槽及动态组件

小 P 周刊 Vol.08
随机推荐
数字藏品系统源码搭建
Use yolov5 to train your own data set and get started quickly
杰理之BLE SPP 开启 pin_code 功能【篇】
IIHS tsp+ annual safety list released: 7 EVs were selected, and there are common problems in pedestrian AEB
错误的导航分类横条代码版本
Team level safety training, new employee induction training education courseware, full content ppt application
AcWing 1944. Record keeping (hash, STL)
JS set IP mask
Application of volatile in single chip microcomputer
Method of converting VOC format data set to Yolo format data set
34. find the first and last positions of elements in the sorted array ●●
Working principle analysis of rxjs fromEvent
MySQL download, installation and use - complete and detailed steps
没有财富就不能自由吗?
2022健博会,北京大健康产业展,艾灸健康展,北京健康服务展
Set the default receiving address [project mall]
迭代器模式--沙场秋点兵
Where is it safer to open an account for soda ash futures? How much capital is needed to trade soda ash futures at present?
杰理之获取 BLE 出现电压检测、ADC 检测不准【篇】
2022 Beijing International Nutrition and Health Industry Expo, the 9th China Great Health Industry Exhibition