Current location - Quotes Website - Signature design - How to use JSSDK in the development of WeChat WeChat official account
How to use JSSDK in the development of WeChat WeChat official account

WeChat development exchange group: 14854125

Welcome to leave a message, forward and reward

Reference address of series of articles to develop WeChat WeChat official account

Project source code reference address click me-welcome to Start

Service number and subscription number, which can be viewed and developed by logging in to WeChat public platform > Interface permissions

using the JSSDK mainly includes

1, judging whether the current client version supports the specified JS interface,

2, sharing interface (WeChat authentication)

3, image interface

4, audio interface

5, intelligent interface (recognizing voice and returning results)

6, and device information (obtaining network status). Geographical location

8, interface operation

9, WeChat scanning

1, WeChat store (service number must pass WeChat authentication)

11, WeChat card voucher (WeChat authentication)

12, WeChat payment (service number must pass WeChat authentication)

Official reference document

Step 1: bind the domain name.

Step 2: Introduce JS file

Introduce the following JS file on the page where JS interface needs to be called (support /open/js/jweixin-1...js

If you need to use the shake peripheral function, Please introduce /open/js/jweixin-1.1..js

Note: AMD/CMD standard module loading method is supported

Step 3: Inject the authorization verification configuration

signature algorithm generation rules through the config interface

Please refer to the official document

Specifically, the encapsulation in the open source project weixin_guide is described below.

when you use it, you only need to add an interceptor JSSDKInterceptor to the Controller method to realize signature verification, and then get the properties corresponding to the parameter settings required by wx.config on the page.

the interceptor is implemented as follows:

use

JSP page in the Controller and use

test results

to add route me.add ("/jssdk", jssdkcontroller.class, "/view") in AppConfig; Visit http:// domain name [/project name ]/jssdk in your mobile phone. If debug= true is set, it will pop up

if {"errormsg": "config: invalid URL domian"} appears. Please check whether the binding domain name and the domain name you visited are in the safe domain name list

Step 4: Successful verification through the ready interface

Step 5: Failure verification through the error interface

Step 6: Interface calling

Interceptor to realize the reference address point here

js interface calling the reference address point here

That's the introduction of JSSDK use.

Welcome to leave a message, forward and reward items

Click me at the source code reference address-welcome to Start.