当前位置:网站首页>Wechat official account web page authorization login is so simple
Wechat official account web page authorization login is so simple
2022-07-05 16:56:00 【Hua Weiyun】
Preface
This article will help you master from 0 To 1 Realize the authorized login of wechat public platform
- What are the steps of authorized login of wechat official account
- token url , How to configure a secure domain name
- How to write the code
- What to do if something goes wrong
One 、 What are the steps of authorized login of wechat official account
Introduction to official documents
The document looks complex , In fact, the front end only needs two steps :
1、 Go to one provided by wechat url Address
perhaps
The difference between the two is :scope by snsapi_base and scope by snsapi_userinfo, The difference is Pop up user authorization ;
Application authorization scope ,snsapi_base ( Do not pop up the authorization page , Direct jump , Only users can be obtained openid),snsapi_userinfo ( Authorization page pops up , It can be done by openid Get a nickname 、 Gender 、 home . also , Even if you don't pay attention , As long as the user is authorized , Information can also be obtained ) |
Where you need to configure this address is :appid( WeChat official account id) and redirect_uri( token url )
2、 After visiting this address , Wechat will jump back to your settings redirect_uri Address , And bring back one code,
Put this code To the backstage , The interface to access wechat in the background , Get the user's openid and access_token,
We have also realized the authorized login of wechat here .
Two 、 token url , How to configure a secure domain name
- 1、 Before applying for the official account number , You can apply for the system through the test number first , Quickly apply for an interface test number , Start interface test development now .( Test number application address )
redirect_uri Configuration of :
It only needs Please note that , Here is the domain name ( Is a string ), instead of URL, So do not add http:// Equal protocol header ;).
((1) Open the wechat official account test account ( It is convenient to develop modes ), modify js Secure domain name , You can also set 192 The address of
(2) Find the experience interface permission table - Web account - modify
(3) Set callback domain name
(4) Wechat official account official account setting
3、 ... and 、 How to write the code
The code is as follows ( Example ):
Four 、 What if something goes wrong
When there's a problem with development , Return code that can be called through the interface , And alarm troubleshooting guidelines ( On the official website of the public platform - Interface alarm can be set at the developer center ), To find and solve problems
Last
Originality is not easy. , I also hope you guys can support !
give the thumbs-up , Your recognition is the driving force of my creation !
️ Collection , Your favor is the direction of my efforts !
️ Comment on , Your opinion is the wealth of my progress !
边栏推荐
- Flet tutorial 12 stack overlapping to build a basic introduction to graphic and text mixing (tutorial includes source code)
- How to uninstall MySQL cleanly
- [brush questions] effective Sudoku
- [deep learning] how does deep learning affect operations research?
- Win11 prompt: what if the software cannot be downloaded safely? Win11 cannot download software safely
- Google Earth Engine(GEE)——Kernel核函数简单介绍以及灰度共生矩阵
- 精准防疫有“利器”| 芯讯通助力数字哨兵护航复市
- Games101 notes (I)
- 【剑指 Offer】62. 圆圈中最后剩下的数字
- [深度学习][原创]让yolov6-0.1.0支持yolov5的txt读取数据集模式
猜你喜欢
解决CMakeList find_package找不到Qt5,找不到ECM
The two ways of domestic chip industry chain go hand in hand. ASML really panicked and increased cooperation on a large scale
极坐标扇图使用场景与功能详解
Deep dive kotlin synergy (XXI): flow life cycle function
Bs-xx-042 implementation of personnel management system based on SSM
采用药丸屏的iPhone14或引发中国消费者的热烈抢购
Win11 prompt: what if the software cannot be downloaded safely? Win11 cannot download software safely
"21 days proficient in typescript-3" - install and build a typescript development environment md
Domestic API management artifact used by the company
深潜Kotlin协程(二十一):Flow 生命周期函数
随机推荐
解决CMakeList find_package找不到Qt5,找不到ECM
Win11如何给应用换图标?Win11给应用换图标的方法
composer安装报错:No composer.lock file present.
Jarvis OJ Flag
Get ready for the pre-season card game MotoGP ignition champions!
yarn 常用命令
Pspnet | semantic segmentation and scene analysis
[js] skill simplification if empty judgment
Basic introduction to the control of the row component displaying its children in the horizontal array (tutorial includes source code)
【刷题篇】有效的数独
tf.sequence_mask函数讲解案例
The two ways of domestic chip industry chain go hand in hand. ASML really panicked and increased cooperation on a large scale
Games101 notes (II)
Writing method of twig array merging
微信公众号网页授权登录实现起来如此简单
Explain in detail the functions and underlying implementation logic of the groups sets statement in SQL
Apple 已弃用 NavigationView,使用 NavigationStack 和 NavigationSplitView 实现 SwiftUI 导航
用键盘输入一条命令
Apple has abandoned navigationview and used navigationstack and navigationsplitview to implement swiftui navigation
极坐标扇图使用场景与功能详解