久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<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="qwawimqqmiuu" 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="qwawimqqmiuu" 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 問題的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  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"標(biāo)頭資源.因此,不允許使用來源 '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.

                  我不知道為什么即使我已經(jīng)使用 github 注冊了 oauth 應(yīng)用程序并且回調(diào) 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 端點通過發(fā)送正確的響應(yīng)頭來支持 CORS,它是 一個已知的問題 用于創(chuàng)建 OAuth 訪問令牌的 https://github.com/login/oauth/access_token 端點不支持來自 Web 應(yīng)用程序的 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:使客戶端應(yīng)用程序能夠與 GitHub 共舞 OAuth.

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

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

                  這真是太糟糕了.因此,我們構(gòu)建了 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 進(jìn)行反向代理和添加 CORS 標(biāo)頭.

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

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

                  相關(guān)文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調(diào)用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調(diào)用完成)
                  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標(biāo)頭) - IT屋-程序員軟件開發(fā)技術(shù)分
                  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 部分內(nèi)容)
                    <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="qwawimqqmiuu" 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>

                          • 主站蜘蛛池模板: 免费一区二区三区 | 国产欧美精品 | 久久久国产一区二区 | wwwsihu| 又爽又黄axxx片免费观看 | 中文字幕日韩一区 | 欧美黄色小视频 | aⅴ色国产 欧美 | 91精品一区二区三区久久久久久 | 亚洲+变态+欧美+另类+精品 | 欧美一区二区三区四区五区无卡码 | 精品永久 | 国产一区二区三区 | 免费久久久 | 久久新 | 久草免费在线视频 | 成人一区av偷拍 | 日韩一区二区在线视频 | 天天插日日操 | 成av在线| 久久国产精品一区二区三区 | 精品久久久久久18免费网站 | 国产成人在线视频播放 | 国产99视频精品免费播放照片 | 欧美成人免费在线视频 | 成人自拍av | 成年男女免费视频网站 | 日日操网站| 亚洲精品68久久久一区 | 欧美一区二区三区视频 | 日本成人福利视频 | 成人在线网| 精品色 | www.国产精品 | 国外激情av| 一区二区在线视频 | 一区二区三区高清 | 久久成人精品一区二区三区 | 免费视频久久 | 日韩一区二区三区在线视频 | 二区中文字幕 |