pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<i id='TZStT'><tr id='TZStT'><dt id='TZStT'><q id='TZStT'><span id='TZStT'><b id='TZStT'><form id='TZStT'><ins id='TZStT'></ins><ul id='TZStT'></ul><sub id='TZStT'></sub></form><legend id='TZStT'></legend><bdo id='TZStT'><pre id='TZStT'><center id='TZStT'></center></pre></bdo></b><th id='TZStT'></th></span></q></dt></tr></i><div class="jlrlugl" id='TZStT'><tfoot id='TZStT'></tfoot><dl id='TZStT'><fieldset id='TZStT'></fieldset></dl></div>
    • <bdo id='TZStT'></bdo><ul id='TZStT'></ul>
  • <legend id='TZStT'><style id='TZStT'><dir id='TZStT'><q id='TZStT'></q></dir></style></legend>

      <small id='TZStT'></small><noframes id='TZStT'>

        <tfoot id='TZStT'></tfoot>

        github oauth 上的 cors 問題

        cors issue on github oauth(github oauth 上的 cors 問題)
        <tfoot id='NolBq'></tfoot>
        <i id='NolBq'><tr id='NolBq'><dt id='NolBq'><q id='NolBq'><span id='NolBq'><b id='NolBq'><form id='NolBq'><ins id='NolBq'></ins><ul id='NolBq'></ul><sub id='NolBq'></sub></form><legend id='NolBq'></legend><bdo id='NolBq'><pre id='NolBq'><center id='NolBq'></center></pre></bdo></b><th id='NolBq'></th></span></q></dt></tr></i><div class="whzxeck" id='NolBq'><tfoot id='NolBq'></tfoot><dl id='NolBq'><fieldset id='NolBq'></fieldset></dl></div>

        <legend id='NolBq'><style id='NolBq'><dir id='NolBq'><q id='NolBq'></q></dir></style></legend>

        <small id='NolBq'></small><noframes id='NolBq'>

            <tbody id='NolBq'></tbody>
            <bdo id='NolBq'></bdo><ul id='NolBq'></ul>

                1. 本文介紹了github oauth 上的 cors 問題的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  import request from 'superagent';
                  
                  const self = this;
                      request
                        .post('https://github.com/login/oauth/access_token')
                        .set('Content-Type', 'multipart/form-data')
                        .query({
                          client_id: CLIENT_ID,
                          client_secret: CLIENT_SECRET,
                          callback: 'http://127.0.0.1:3000/callback',
                          code,
                          state,
                        })
                        .end((err, res) => {
                          const token = res.body.access_token;
                          console.log(token);
                          self.setToken(token);
                        });

                  上面的代碼會給我這樣的錯誤

                  The code above will give me an error like this

                  XMLHttpRequest 無法加載https://github.com/login/oauth/access_token?client_id=112asdecf3805fdada12&…127.0.0.1%3A3000%2Fcallback&code=434ebd7bb98d9809bf6e&state=HelloWorld1234.請求中不存在Access-Control-Allow-Origin"標頭資源.因此,不允許使用來源 'http://127.0.0.1:3000'訪問.

                  XMLHttpRequest cannot load https://github.com/login/oauth/access_token?client_id=112asdecf3805fdada12&…127.0.0.1%3A3000%2Fcallback&code=434ebd7bb98d9809bf6e&state=HelloWorld1234. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:3000' is therefore not allowed access.

                  我不知道為什么即使我已經使用 github 注冊了 oauth 應用程序并且回調 url 是 http://127.0.0.1:3000/callback

                  I have no idea why even though I've registered the oauth application with github and callback url is http://127.0.0.1:3000/callback

                  推薦答案

                  雖然所有實際的 GitHub API 端點通過發送正確的響應頭來支持 CORS,它是 一個已知的問題 用于創建 OAuth 訪問令牌的 https://github.com/login/oauth/access_token 端點不支持來自 Web 應用程序的 CORS 請求.

                  While all the actual GitHub API endpoints support CORS by sending the right response headers, it is a known issue that the https://github.com/login/oauth/access_token endpoint for creating an OAuth access token does not support CORS requests from Web applications.

                  這種情況的非常具體的解決方法是使用 https://github.com/prose/gatekeeper:

                  The very specific workaround for this case is to use https://github.com/prose/gatekeeper:

                  Gatekeeper:使客戶端應用程序能夠與 GitHub 共舞 OAuth.

                  由于一些與安全相關的限制,Github 阻止您在僅客戶端應用程序上實施 OAuth Web 應用程序流程.

                  Because of some security-related limitations, Github prevents you from implementing the OAuth Web Application Flow on a client-side only application.

                  這真是太糟糕了.因此,我們構建了 Gatekeeper,這是您使其工作所需的缺失部分.

                  This is a real bummer. So we built Gatekeeper, which is the missing piece you need in order to make it work.

                  一般的解決方法是:使用開放的反向代理,例如 https://cors-anywhere.herokuapp.com/

                  The general workaround is: Use an open reverse proxy like https://cors-anywhere.herokuapp.com/

                  var req = new XMLHttpRequest();
                  req.open('POST',
                    'https://cors-anywhere.herokuapp.com/https://github.com/login/oauth/access_token',
                    true);
                  req.setRequestHeader('Accept', 'application/json');
                  req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                  req.send('code=' + encodeURIComponent(location.query.code) +
                      '&client_id=foo' +
                      '&client_secret=bar');
                  ...
                  

                  另請參閱 如何在任何地方使用 Cors 進行反向代理和添加 CORS 標頭.

                  這篇關于github oauth 上的 cors 問題的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  NETWORK_ERROR: XMLHttpRequest Exception 101(NETWORK_ERROR:XMLHttpRequest 異常 101)
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                    <i id='anDUG'><tr id='anDUG'><dt id='anDUG'><q id='anDUG'><span id='anDUG'><b id='anDUG'><form id='anDUG'><ins id='anDUG'></ins><ul id='anDUG'></ul><sub id='anDUG'></sub></form><legend id='anDUG'></legend><bdo id='anDUG'><pre id='anDUG'><center id='anDUG'></center></pre></bdo></b><th id='anDUG'></th></span></q></dt></tr></i><div class="xcyasp7" id='anDUG'><tfoot id='anDUG'></tfoot><dl id='anDUG'><fieldset id='anDUG'></fieldset></dl></div>
                  1. <small id='anDUG'></small><noframes id='anDUG'>

                        • <bdo id='anDUG'></bdo><ul id='anDUG'></ul>

                          • <legend id='anDUG'><style id='anDUG'><dir id='anDUG'><q id='anDUG'></q></dir></style></legend>

                            <tfoot id='anDUG'></tfoot>
                              <tbody id='anDUG'></tbody>

                          • 主站蜘蛛池模板: 智能终端_RTU_dcm_北斗星空自动化科技 | 上海新光明泵业制造有限公司-电动隔膜泵,气动隔膜泵,卧式|立式离心泵厂家 | 【化妆品备案】进口化妆品备案流程-深圳美尚美化妆品有限公司 | 飞歌臭氧发生器厂家_水处理臭氧发生器_十大臭氧消毒机品牌 | 注塑_注塑加工_注塑模具_塑胶模具_注塑加工厂家_深圳环科 | 安德建奇火花机-阿奇夏米尔慢走丝|高维|发那科-北京杰森柏汇 | 博莱特空压机|博莱特-阿特拉斯独资空压机品牌核心代理商 | 上海律师事务所_上海刑事律师免费咨询平台-煊宏律师事务所 | 好杂志网-首页| 闭端端子|弹簧螺式接线头|防水接线头|插线式接线头|端子台|电源线扣+护线套|印刷电路板型端子台|金笔电子代理商-上海拓胜电气有限公司 | 渣油泵,KCB齿轮泵,不锈钢齿轮泵,重油泵,煤焦油泵,泊头市泰邦泵阀制造有限公司 | 合肥白癜风医院_合肥治疗白癜风医院_合肥看白癜风医院哪家好_合肥华研白癜风医院 | 成都茶楼装修公司 - 会所设计/KTV装修 - 成都朗煜装饰公司 | 楼承板-开口楼承板-闭口楼承板-无锡海逵 | 不锈钢反应釜,不锈钢反应釜厂家-价格-威海鑫泰化工机械有限公司 不干胶标签-不干胶贴纸-不干胶标签定制-不干胶标签印刷厂-弗雷曼纸业(苏州)有限公司 | 胶水,胶粘剂,AB胶,环氧胶,UV胶水,高温胶,快干胶,密封胶,结构胶,电子胶,厌氧胶,高温胶水,电子胶水-东莞聚力-聚厉胶粘 | 龙门加工中心-数控龙门加工中心厂家价格-山东海特数控机床有限公司_龙门加工中心-数控龙门加工中心厂家价格-山东海特数控机床有限公司 | 地图标注-手机导航电子地图如何标注-房地产商场地图标记【DiTuBiaoZhu.net】 | 膜片万向弹性联轴器-冲压铸造模具「沧州昌运模具」 | 袋式过滤器,自清洗过滤器,保安过滤器,篮式过滤器,气体过滤器,全自动过滤器,反冲洗过滤器,管道过滤器,无锡驰业环保科技有限公司 | 高速混合机_锂电混合机_VC高效混合机-无锡鑫海干燥粉体设备有限公司 | 工业淬火油烟净化器,北京油烟净化器厂家,热处理油烟净化器-北京众鑫百科 | 在线钠离子分析仪-硅酸根离子浓度测定仪-油液水分测定仪价格-北京时代新维测控设备有限公司 | 广东之窗网 | 缠膜机|缠绕包装机|无纺布包装机-济南达伦特机械设备有限公司 | 底部填充胶_电子封装胶_芯片封装胶_芯片底部填充胶厂家-东莞汉思新材料 | 杭州货架订做_组合货架公司_货位式货架_贯通式_重型仓储_工厂货架_货架销售厂家_杭州永诚货架有限公司 | 河南中整光饰机械有限公司-抛光机,去毛刺抛光机,精密镜面抛光机,全自动抛光机械设备 | 电位器_轻触开关_USB连接器_广东精密龙电子科技有限公司 | 飞飞影视_热门电影在线观看_影视大全 | 合肥制氮机_合肥空压机厂家_安徽真空泵-凯圣精机 | 小港信息港-鹤壁信息港 鹤壁老百姓便民生活信息网站 | 注塑_注塑加工_注塑模具_塑胶模具_注塑加工厂家_深圳环科 | 南京欧陆电气股份有限公司-风力发电机官网 | RTO换向阀_VOC高温阀门_加热炉切断阀_双偏心软密封蝶阀_煤气蝶阀_提升阀-湖北霍科德阀门有限公司 | 香蕉筛|直线|等厚|弧形|振动筛|香蕉筛厂家-洛阳隆中重工 | 清水混凝土修复_混凝土色差修复剂_混凝土色差调整剂_清水混凝土色差修复_河南天工 | 爱佩恒温恒湿测试箱|高低温实验箱|高低温冲击试验箱|冷热冲击试验箱-您身边的模拟环境试验设备技术专家-合作热线:400-6727-800-广东爱佩试验设备有限公司 | 电缆接头_防水接头_电缆防水接头 - 乐清市新豪电气有限公司 | 企业微信营销_企业微信服务商_私域流量运营_艾客SCRM官网 | 密集柜_档案密集柜_智能密集架_密集柜厂家_密集架价格-智英伟业 密集架-密集柜厂家-智能档案密集架-自动选层柜订做-河北风顺金属制品有限公司 |