JQuery太难了!

萤下客 2020-07-21 07:00:24
我用js做github登录,知道code,要get,我这样
$.ajax({
url:"https://github.com:443/login/oauth/access_token",
data:{
client_id:"c4aea767dd3d3b7a3e27",
client_secret:"d4e9bb798f10b9f4012c121ab9616cc3d751f5dd",
code:code
},
type:"GET",
success:function(re){
console.log(re);
}
});

报错了
我怎么办??????????
...全文
4999 17 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
萤下客 2020-07-25
  • 打赏
  • 举报
回复
strict MIME type checking is enabled strict MIME type checking is enabled strict MIME type checking is enabled strict MIME type checking is enabled strict MIME type checking is enabled
萤下客 2020-07-25
  • 打赏
  • 举报
回复
不行啊,js有点难的
浴火_凤凰 2020-07-23
  • 打赏
  • 举报
回复
看明白了 你的 请求已经是我说的JSONP了。。那不需要代理了 callback=666不行 如果你没有自定义回调 函数 就写 callback=?
萤下客 2020-07-23
  • 打赏
  • 举报
回复
引用 13 楼 浴火_凤凰 的回复:
自己玩的话 可以自己找个代理 工具也行 代码也行 如果是做产品的话 必须让GitHub改。或者看看GitHub有没有提供JSONP方式
只需要帮我解决Refused to execute script from 'https://github.com/login/oauth/access_token?client_id=***&client_secret=***&code=***&callback=jQuery214023505195085585773_1595498380935&_=1595498380936' because its MIME type ('application/x-www-form-urlencoded') is not executable, and strict MIME type checking is enabled.
浴火_凤凰 2020-07-23
  • 打赏
  • 举报
回复
自己玩的话 可以自己找个代理 工具也行 代码也行 如果是做产品的话 必须让GitHub改。或者看看GitHub有没有提供JSONP方式
萤下客 2020-07-23
  • 打赏
  • 举报
回复
求求大侠帮帮我
萤下客 2020-07-23
  • 打赏
  • 举报
回复
按csdn的攻略修改成
alert($.ajax({url:"https://github.com:443/login/oauth/access_token?client_id=d5***********108&callback=666&client_secret=f114a9b6********a85f3d&code="+code,dataType:"jsonp",contentType:"application/x-www-form-urlencoded"}));
读取倒是成功了,但是报错 错误是
Refused to execute script from 'https://github.com/login/oauth/access_token?client_id=***&client_secret=***&code=***&callback=jQuery214023505195085585773_1595498380935&_=1595498380936' because its MIME type ('application/x-www-form-urlencoded') is not executable, and strict MIME type checking is enabled.
萤下客 2020-07-23
  • 打赏
  • 举报
回复
引用 7 楼 浴火_凤凰 的回复:
跨域了 只能GitHub方面添加 跨域设置 或者 你通过服务器中转你的请求 也就是代理
方案一:github的api我改不了 方案二:代理我不会 怎么办
  • 打赏
  • 举报
回复
其实你可以直接根据报错信息区搜索
chenrynet 2020-07-23
  • 打赏
  • 举报
回复
我都放弃jquery 了 直接js
hookee 2020-07-22
  • 打赏
  • 举报
回复
请求跨域了。 用服务器端请求代理。如果远程支持跨域请求的话,加跨域请求头.
浴火_凤凰 2020-07-22
  • 打赏
  • 举报
回复
跨域了 只能GitHub方面添加 跨域设置 或者 你通过服务器中转你的请求 也就是代理
chunchun_123 2020-07-22
  • 打赏
  • 举报
回复
跨域了 做第三方登录不应该直接从前端去请求第三方接口
usecf 2020-07-22
  • 打赏
  • 举报
回复
跨域了 在服务器端增加下跨域设置 了解下相关 知识 https://blog.csdn.net/yup1212/article/details/87633272
叫兽-郭老师 2020-07-22
  • 打赏
  • 举报
回复
萤下客 2020-07-21
  • 打赏
  • 举报
回复
还有,id和secret不小心泄露了
萤下客 2020-07-21
  • 打赏
  • 举报
回复
就是说,怎么改

87,996

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧