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

    <legend id='uoo1Y'><style id='uoo1Y'><dir id='uoo1Y'><q id='uoo1Y'></q></dir></style></legend>
    • <bdo id='uoo1Y'></bdo><ul id='uoo1Y'></ul>
      <tfoot id='uoo1Y'></tfoot>

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

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

        如何保護(hù) JavaScript API 訪問令牌?

        How to secure the JavaScript API Access Token?(如何保護(hù) JavaScript API 訪問令牌?)
        • <bdo id='opRpA'></bdo><ul id='opRpA'></ul>

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

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

            1. <tfoot id='opRpA'></tfoot>
                  <tbody id='opRpA'></tbody>
                <i id='opRpA'><tr id='opRpA'><dt id='opRpA'><q id='opRpA'><span id='opRpA'><b id='opRpA'><form id='opRpA'><ins id='opRpA'></ins><ul id='opRpA'></ul><sub id='opRpA'></sub></form><legend id='opRpA'></legend><bdo id='opRpA'><pre id='opRpA'><center id='opRpA'></center></pre></bdo></b><th id='opRpA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='opRpA'><tfoot id='opRpA'></tfoot><dl id='opRpA'><fieldset id='opRpA'></fieldset></dl></div>
                  本文介紹了如何保護(hù) JavaScript API 訪問令牌?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時送ChatGPT賬號..

                  有許多在線資源提供 JavaScript API 來訪問他們的服務(wù).為了更清楚,我的問題將基于 MapBox 的示例,但這適用于許多其他服務(wù)在各個領(lǐng)域.

                  There are numerous online resources which provide JavaScript APIs to access their services. To be more clear, I will base my question on the example of MapBox, but this applies well to many other services in various domains.

                  當(dāng)有人想在 Web 應(yīng)用程序中使用此類服務(wù)??(例如 MapBox 中的地圖圖像)時,他們通常需要注冊/注冊并獲取 訪問令牌 才能訪問該服務(wù).

                  When someone wants to use such a service in a web application (like the map imagery from MapBox for example), they typically need to Register/Sign Up and obtain an access token to access the service.

                  現(xiàn)在,如果我從服務(wù)器端使用 API - 沒有問題:我知道我的令牌安全地存儲在服務(wù)器上的某個位置,并且僅在我的服務(wù)器和服務(wù)提供商之間進(jìn)行通信時公開,這可以長是 HTTPS.但是,對于 JavaScript API(例如,如果我使用 Leaflet 從 MapBox 呈現(xiàn)地圖),我是應(yīng)該在暴露給用戶的網(wǎng)絡(luò)瀏覽器的 JavaScript 中具有 我的訪問令牌 - 因此它可以非常容易地找到某人的訪問令牌.我的用戶,或者在公共服務(wù)的情況下,實際上是任何人,都可以在瀏覽器的開發(fā)工具"中找到令牌.

                  Now, if I would use the API from the server side - there is no issue: I know my token is stored securely somewhere on the server and is only exposed upon communication between my server and the service provider, which is OK as long it is HTTPS. However, in case of a JavaScript API (for example if I use Leaflet to render a map from MapBox), I am supposed to have my access token in a JavaScript which is exposed to the user's web browser - and so it makes it extremely easy to find someone's access token. My users, or in a case of a public service, literally anyone, would be able to find the token in the browser's "Dev Tools".

                  然而,就我而言,這個令牌應(yīng)該被視為一種有意義的數(shù)據(jù)——服務(wù)使用情況是根據(jù)這個令牌提供的身份驗證來跟蹤的.如果您根據(jù)使用情況為服務(wù)付費(fèi),這將變得至關(guān)重要,但即使您不這樣做(例如,如果您使用免費(fèi)/入門/非付費(fèi)計劃) - 服務(wù)使用是有限的,我想確定一下只有我使用它.

                  This token however, as for me, should be considered as a sensetive data - service usage is tracked based on the authentication this token provides. If you pay for the service based on its usage it becomes critical, but even if you don't (like, if you use a Free/Starter/Non Paid plan) - service usage is limited and I'd like to be sure it is only me who uses it.

                  我唯一的選擇是通過我自己的網(wǎng)絡(luò)服務(wù)器代理嗎?

                  Is my only option a proxy via my own web server?

                  如果 JavaScript 在用戶的瀏覽器中執(zhí)行,有沒有辦法保護(hù) JavaScript API 用來訪問外部服務(wù)的訪問令牌?

                  Is there a way to secure the access token used by a JavaScript API to access an external service, provided that JavaScript is executed in a user's browser?

                  推薦答案

                  使用 CORS 限制訪問

                  使用 CORS 設(shè)置讓您的網(wǎng)絡(luò)服務(wù)器在 ajax 請求中返回訪問令牌.可以使用此方法訪問您的應(yīng)用程序來捕獲令牌.

                  Make your web server return the access tokens on an ajax request from you javascript with CORS setup. Token can be captured with this method visiting your app.

                  向授權(quán)用戶提供令牌

                  您還可以在您的網(wǎng)絡(luò)服務(wù)器上添加身份驗證,以向您允許的用戶提供有限的訪問權(quán)限.令牌可以使用此方法獲取,但只能由授權(quán)用戶獲取.

                  You can also add authentication on your webserver to provide limited access to the users you allow. Token can be captured with this method but only by authorized users.

                  代理請求

                  完全保護(hù)該令牌的唯一方法是通過您的服務(wù)器代理請求.使用此方法無法捕獲令牌.請注意,這可能違反服務(wù)條款.

                  The only way to completely protect that token is to proxy the requests through your server. Token cannot be captured with this method. Note that this may be against terms of service.

                  這篇關(guān)于如何保護(hù) JavaScript API 訪問令牌?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  Browserify, Babel 6, Gulp - Unexpected token on spread operator(Browserify,Babel 6,Gulp - 傳播運(yùn)算符上的意外令牌)
                  Is it possible to pass a flag to Gulp to have it run tasks in different ways?(是否可以將標(biāo)志傳遞給 Gulp 以使其以不同的方式運(yùn)行任務(wù)?)
                  Why do we need to install gulp globally and locally?(為什么我們需要在全局和本地安裝 gulp?)
                  How to run Gulp tasks sequentially one after the other(如何一個接一個地依次運(yùn)行 Gulp 任務(wù))
                  Visual Studio 2015 crashes when opening Javascript files(打開 Javascript 文件時 Visual Studio 2015 崩潰)
                  Detect FLASH plugin crashes(檢測 FLASH 插件崩潰)
                  <legend id='7kwNs'><style id='7kwNs'><dir id='7kwNs'><q id='7kwNs'></q></dir></style></legend>

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

                            <small id='7kwNs'></small><noframes id='7kwNs'>

                          • 主站蜘蛛池模板: 国产欧美精品一区二区色综合朱莉 | 亚洲电影一区二区三区 | 欧美日韩成人 | 国产精品一级在线观看 | 野狼在线社区2017入口 | 成人免费三级电影 | 亚洲福利一区二区 | 欧美日韩精品一区二区三区四区 | 精品欧美色视频网站在线观看 | 国产欧美精品 | 久久综合色综合 | 久久网一区二区三区 | wwwxxx日本在线观看 | 一级高清视频 | 91色综合| 日韩精品一区二区在线 | 成人啊啊啊 | 蜜臀av日日欢夜夜爽一区 | 精品福利在线 | gogo肉体亚洲高清在线视 | 欧美一区不卡 | 日韩av免费在线电影 | 日韩国产在线 | 毛片网站在线观看 | 国产精品视频一区二区三区 | 最新黄色在线观看 | 日韩精品在线观看视频 | 国产欧美在线观看 | 91精品国产91久久久久久最新 | 久久久久久99 | 国内精品99 | 欧美日韩在线播放 | 日韩中文一区二区三区 | 亚洲综合在线视频 | 青青操91| 99在线资源 | 亚洲欧美精品 | 国产九九av| 欧美日日| 91精品国产一区二区三区 | 国产精品久久久久久久久久免费看 |