$.ajax({ url:"http://172.16.5.33:88/blade-auth/oauth/token", type:'post',//HTTP请求类型 data:{ grant_type:"refresh_token", scope:"all", refresh_token:refresh }, headers:{ "Content-Type":"application/x-www-form-urlencoded", "Authorization":"Basic c3dvcmQ6c3dvcmRfc2VjcmV0", "Tenant-Id": "000000" }, success:function(res){ console.log(res) } }) 这是登入和刷新token的接口,为什么请求头加入Tenant-Id就会报错,我一查百度显示的是首先要会发送一次options预检,后台通过才发起 正式的post的请求,但是如果在请求头中加入了这个参数就会报错,不加入的话登入就是那个默认的000000管理员账号,其它注册的账号登不上 报错提示: Access to XMLHttpRequest at 'http://172.16.5.33:88/blade-auth/oauth/token' from origin 'http://127.0.0.1:8848' has been blocked by CORS policy: Request header field tenant-id is not allowed by Access-Control-Allow-Headers in preflight response.
扫一扫访问 Blade技术社区 移动端