D small classroom -SpringBoot 2.x micro-channel pay online educational website project combat _5-4 micro letter authorizing a key sign in the development of URL obtain authorization

notes


4, micro-channel authorization authorized a key sign in the development of URL acquiring
    Description: Get WeChat open platform url address even scan code

    1, increase the results of tools, JsonData; increase application.properties configuration
        # WeChat open platform configuration
        wxopen.appid =
        wxopen.appsecret =
        # redirect url
        wxopen.redirect_url = HTTP: // the Test / Pub / API / v1 / wechat / the User / callback1

      wechatConfig which increase property

    / **
     * weChat open platform connecting two-dimensional code
     * /
    Private Final OPEN_QRCODE_URL static String = "HTTPS : //open.weixin.qq.com/connect/qrconnect appid =% s & redirect_uri =% s & response_type = code & scope = snsapi_login & state =% s # wechat_redirect ";?
    
 

Start

Adding a tool class



data type returned interface transform the look. testControlller the test


code status code 0 is taken on the inside of the data, the operation fails either 0

Configuration

Get this on the micro-channel configuration



also redirect_url callback address

plus arranged in the configuration file. Then generate getter and setter methods


to copy the address to the profile of the two-dimensional codes, keywords replaced with s%. Also generate getter and setter methods.


Create a WebCharController


callback need to pass the address of the current page

to url encode will throw an exception


eventually return qrCodeUrl


start the application tested

here a ReponseBody added a comment, do not know is not the reason,



the Controller should be here inside address getOpenRrcodeUrl this


copy this value into your browser to access

callback address into formal callback address. Reply callback address inside the configuration.


Here should getOpenAppId ()

again to access interface, copy the address

to copy the address to open the browser to access

the address where the changed xdclass.net


is now going to check the address of this redirect_url

or to change it back to this address


 

Guess you like

Origin www.cnblogs.com/wangjunwei/p/11482505.html