How to get the user information of Wechat login on the pc side only through the foreground (ajax) but not through the background (java)?

problem description

Wechat, a third party on PC, logs in and redirects to the authorized destroyed address after the user has scanned the code. When sending a request to obtain user information through the ajax at the front end, there will be a cross-domain problem. How to solve this cross-domain problem.

the environmental background of the problems and what methods you have tried

Environment: the project is deployed to the server under the authorized callback domain filled in on Wechat"s open platform.
tried the method: use Yahoo"s third-party api, to obtain user information, but this is very insecure.

related codes

through this reference, put the QR code on the page, and the user clicks Wechat to log in to display the QR code
https://open.weixin.qq.com/co.&redirect_uri=http:///index.html&response_type=code&scope=snsapi_login-sharpwechat_redirect"
to obtain user information through ajax and Yahoo third parties

        $.ajax({//
            url: "http://query.yahooapis.com/v1/public/yql",
            dataType: "jsonp",
            data: {
                q: "select * from json where url=\"" + targetUrl1 + """,
                format: "json"
            },
            success:function(data){
                ***********
            }
        })

what result do you expect? What is the error message actually seen?

get user information through the foreground instead of using ajax through your own background, and deal with cross-domain problems.
(the reason for not going through the backstage is that the backstage left and could not recruit people. The project manager looked at the document provided by the third party of Wechat and said that it was very detailed and mature, and there should be a solution. What the architect means is that I don"t have enough skills, so there must be a solution, so come here to see if there are any students who have done Wechat"s third-party login problem to help and provide ideas)

Aug.22,2021
Menu