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

  • <small id='dDPHW'></small><noframes id='dDPHW'>

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

      1. <legend id='dDPHW'><style id='dDPHW'><dir id='dDPHW'><q id='dDPHW'></q></dir></style></legend>

          <bdo id='dDPHW'></bdo><ul id='dDPHW'></ul>
        <tfoot id='dDPHW'></tfoot>

        對需要身份驗證的云運行服務的 Ajax 請求

        Ajax request to cloud run service that requires authentication(對需要身份驗證的云運行服務的 Ajax 請求)
        <legend id='xQNM5'><style id='xQNM5'><dir id='xQNM5'><q id='xQNM5'></q></dir></style></legend>
        <i id='xQNM5'><tr id='xQNM5'><dt id='xQNM5'><q id='xQNM5'><span id='xQNM5'><b id='xQNM5'><form id='xQNM5'><ins id='xQNM5'></ins><ul id='xQNM5'></ul><sub id='xQNM5'></sub></form><legend id='xQNM5'></legend><bdo id='xQNM5'><pre id='xQNM5'><center id='xQNM5'></center></pre></bdo></b><th id='xQNM5'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='xQNM5'><tfoot id='xQNM5'></tfoot><dl id='xQNM5'><fieldset id='xQNM5'></fieldset></dl></div>
            <tbody id='xQNM5'></tbody>

              <bdo id='xQNM5'></bdo><ul id='xQNM5'></ul>
              • <tfoot id='xQNM5'></tfoot>

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

                • 本文介紹了對需要身份驗證的云運行服務的 Ajax 請求的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我遇到了與谷歌云有關的 CORS 相關問題,該服務運行在
                  需要身份驗證.

                  I'm having a CORS related issue with google cloud run on a service that
                  requires authentication.

                  如果我嘗試通過 cli 使用 Bearer 令牌執行 curl 命令,
                  一切正常.不幸的是,如果我嘗試在 javascript 中通過 ajax 執行相同的調用,
                  我收到了 403.

                  If I try to execute a curl command through the cli, with a Bearer token,
                  everything works fine. Unfortunately if I try to execute the same call through ajax in javascript,
                  I receive a 403.

                    const http = new XMLHttpRequest();
                    const url = 'https://my-app.run.app';
                  
                    http.open("GET", url);
                    http.withCredentials = true;
                    http.setRequestHeader("authorization", 'Bearer ' + id_token);
                    http.send();
                    http.onreadystatechange = (e) => {
                      console.log(http.responseText)
                    }
                  

                  云運行日志中的錯誤是這樣的:

                  The error in the cloud run logs is this :

                  The request was not authenticated. Either allow unauthenticated invocations or set the proper Authorization header. Read more at https://cloud.google.com/run/docs/securing/authenticating
                  

                  容器永遠不會被擊中.

                  我看到的問題是,當我在網絡中使用 ajax 進行調用時
                  瀏覽器.網絡瀏覽器正在發出飛行前請求(
                  url )而不發送授權標頭(這是預期的
                  行為)

                  The issue I'm seeing is that, as I'm making the call using ajax, in a web
                  browser. The web browser is making a pre flight request ( OPTIONS on the
                  url ) without sending the Authorization header ( which is an expected
                  behavior )

                  問題似乎是云運行嘗試驗證 OPTIONS
                  請求并且永遠不會到達我的容器,據我所知,
                  不應該這樣做.(
                  https://www.w3.org/TR/cors/#cross-origin-request-with-preflight-0 )

                  The problem seems to be that cloud run tries to authenticate the OPTIONS
                  request and never makes it to my container, which, as far as I understand,
                  shouldn't be done. (
                  https://www.w3.org/TR/cors/#cross-origin-request-with-preflight-0 )

                  這是云運行的已知問題嗎?

                  Is that a known issue with cloud run ?

                  如何向經過身份驗證的云運行服務發出 ajax 請求?

                  How could I make an ajax request to an authenticated cloud run service ?

                  推薦答案

                  (Cloud Run PM)

                  (Cloud Run PM)

                  這是一個已知問題.有幾個選項:

                  This is a known issue. There are a few options:

                  1. 允許未經身份驗證的請求并自行執行 CORS/身份驗證
                  1. Allow unauthenticated requests and do CORS/auth yourself
                  1. 使用 Cloud Endpoints 在Cloud Run 在您的計算機前運行.讓 Endpoints 對您的最終用戶進行身份驗證,然后將請求轉發到您的后端.
                  1. There is a variation of this that uses Cloud Endpoints running on Cloud Run in front of your compute. Have Endpoints do your end-user auth, then forward the request to your backend.

                • 從同一域提供服務(例如,使用 Firebase 托管代理)
                • 我們已經考慮實施 Istio CORSPolicy,它將在身份驗證檢查之前返回 CORS 標頭,盡管我們目前還沒有承諾.

                  We've considered implementing Istio CORSPolicy, which would return CORS headers before the auth check, though we're not committed to this as of now.

                  這篇關于對需要身份驗證的云運行服務的 Ajax 請求的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  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 部分內容)
                  XmlHttpRequest onprogress interval(XmlHttpRequest onprogress 間隔)
                  How can I modify the XMLHttpRequest responsetext received by another function?(如何修改另一個函數接收到的 XMLHttpRequest 響應文本?)
                  What is the difference between XMLHttpRequest, jQuery.ajax, jQuery.post, jQuery.get(XMLHttpRequest、jQuery.ajax、jQuery.post、jQuery.get 有什么區別)
                  <i id='TBOFb'><tr id='TBOFb'><dt id='TBOFb'><q id='TBOFb'><span id='TBOFb'><b id='TBOFb'><form id='TBOFb'><ins id='TBOFb'></ins><ul id='TBOFb'></ul><sub id='TBOFb'></sub></form><legend id='TBOFb'></legend><bdo id='TBOFb'><pre id='TBOFb'><center id='TBOFb'></center></pre></bdo></b><th id='TBOFb'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='TBOFb'><tfoot id='TBOFb'></tfoot><dl id='TBOFb'><fieldset id='TBOFb'></fieldset></dl></div>

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

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

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

                          <bdo id='TBOFb'></bdo><ul id='TBOFb'></ul>
                            主站蜘蛛池模板: 中文字幕在线一区二区三区 | 一区二区三区福利视频 | 国产一区二区三区在线看 | 91精品国产综合久久久密闭 | 日本一区二区高清视频 | www.久久 | 91福利在线导航 | 国产精品夜间视频香蕉 | 操操日 | 中文字幕在线观看 | 91视频在线 | 正在播放亚洲 | 国产精品久久久久久久久久软件 | 日本三级电影在线看 | 国产一区二区三区www | 欧美一级在线观看 | 成人精品一区亚洲午夜久久久 | 精品久久久久久亚洲精品 | 日韩欧美视频在线 | 免费一看一级毛片 | 欧美日韩国产中文 | 国产一区欧美一区 | 国产资源在线观看 | 狠狠爱免费视频 | 日韩三级在线 | 久久久久久蜜桃一区二区 | 久久免费观看一级毛片 | 欧美一区二区三区视频在线播放 | 国产精品欧美精品 | 久久久久久91香蕉国产 | 特黄视频 | 精品欧美一区二区在线观看欧美熟 | 一区二区高清不卡 | 国产一级一片免费播放 | 中文字幕日本一区二区 | 国产精品久久 | 久久一区视频 | 国产精品日韩一区二区 | 欧美成人自拍 | 亚洲精品久久久久久久久久吃药 | 91天堂网 |