我想在我的开发计算机上从vue.js发送Google oauth2身份验证。这是功能:
authenticate: function (provider) {
axios.get( this.BASE_URL + "/web/login" , {
token: this.token,
}).then(function(data){
console.log(data);
});
}
但是我在Firefox上遇到了这个错误:
阻止跨源请求:同源策略禁止读取 远程资源在 https://accounts.google.com/o/oauth2/auth?client_id=something.apps.googleusercontent.com& ... (原因:缺少CORS标题'Access-Control-Allow-Origin'。
我使用go gin作为后端并将其设置为使用CORS。
router.Use(cors.Middleware(cors.Config{
Origins: "*",
Methods: "GET, PUT, POST, DELETE",
RequestHeaders: "Origin, Authorization, Content-Type",
ExposedHeaders: "",
MaxAge: 86400,
Credentials: true,
ValidateHeaders: false,
}))
所以想知道谁能解决这个错误。