问答详情
源自:3-8 用户模型管理--getotp页面实现

获取OTP短信验证失败,打开网页输入手机号点击获取OTP后出现以下错误求大神解答,谢谢!

Access to XMLHttpRequest at 'http://localhost:8090/user/getotp' from origin 'http://localhost:63342' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

提问者:weixin_慕仙521292 2019-11-21 10:20

个回答

  • 纸伞遇佳人
    2019-11-27 14:26:04

    Ajax跨域请求问题,设置一下属性就可以了,前端Ajax请求中添加

    xhrFields: {withCredentials: true},
    后端controller层添加@CrossOrigin(origins = "*", allowCredentials = "true")就可以访问了