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

    <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="xvntp5d" id='uoo1Y'><tfoot id='uoo1Y'></tfoot><dl id='uoo1Y'><fieldset id='uoo1Y'></fieldset></dl></div>

        如何保護 JavaScript API 訪問令牌?

        How to secure the JavaScript API Access Token?(如何保護 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="rp7fj7x" id='opRpA'><tfoot id='opRpA'></tfoot><dl id='opRpA'><fieldset id='opRpA'></fieldset></dl></div>
                  本文介紹了如何保護 JavaScript API 訪問令牌?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

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

                  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.

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

                  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.

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

                  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".

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

                  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.

                  我唯一的選擇是通過我自己的網絡服務器代理嗎?

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

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

                  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 設置讓您的網絡服務器在 ajax 請求中返回訪問令牌.可以使用此方法訪問您的應用程序來捕獲令牌.

                  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.

                  向授權用戶提供令牌

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

                  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.

                  代理請求

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

                  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.

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

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

                  相關文檔推薦

                  Browserify, Babel 6, Gulp - Unexpected token on spread operator(Browserify,Babel 6,Gulp - 傳播運算符上的意外令牌)
                  Is it possible to pass a flag to Gulp to have it run tasks in different ways?(是否可以將標志傳遞給 Gulp 以使其以不同的方式運行任務?)
                  Why do we need to install gulp globally and locally?(為什么我們需要在全局和本地安裝 gulp?)
                  How to run Gulp tasks sequentially one after the other(如何一個接一個地依次運行 Gulp 任務)
                  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="577rt5x" 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'>

                          • 主站蜘蛛池模板: 美侍宠物-专注宠物狗及宠物猫训练|喂养|医疗|繁育|品种|价格 | 高精度-恒温冷水机-螺杆式冰水机-蒸发冷冷水机-北京蓝海神骏科技有限公司 | 防腐储罐_塑料储罐_PE储罐厂家_淄博富邦滚塑防腐设备科技有限公司 | 特种阀门-调节阀门-高温熔盐阀-镍合金截止阀-钛阀门-高温阀门-高性能蝶阀-蒙乃尔合金阀门-福建捷斯特阀门制造有限公司 | 污水处理设备-海普欧环保集团有限公司 | 一航网络-软件测评官网 | 培训一点通 - 合肥驾校 - 合肥新亚驾校 - 合肥八一驾校 | 伶俐嫂培训学校_月嫂培训班在哪里报名学费是多少_月嫂免费政府培训中心推荐 | 荣事达手推洗地机_洗地机厂家_驾驶式扫地机_工业清洁设备 | 十字轴_十字轴万向节_十字轴总成-南京万传机械有限公司 | 好物生环保网、环保论坛 - 环保人的学习交流平台 | 环保袋,无纺布袋,无纺布打孔袋,保温袋,环保袋定制,环保袋厂家,环雅包装-十七年环保袋定制厂家 | 12cr1mov无缝钢管切割-15crmog无缝钢管切割-40cr无缝钢管切割-42crmo无缝钢管切割-Q345B无缝钢管切割-45#无缝钢管切割 - 聊城宽达钢管有限公司 | 政府园区专业委托招商平台_助力企业选址项目快速落地_东方龙商务集团 | 陶瓷砂磨机,盘式砂磨机,棒销式砂磨机-无锡市少宏粉体科技有限公司 | 金刚网,金刚网窗纱,不锈钢网,金刚网厂家- 河北萨邦丝网制品有限公司 | 杭州网络公司_百度SEO优化-外贸网络推广_抖音小程序开发-杭州乐软科技有限公司 | 英国公司注册-新加坡公司注册-香港公司开户-离岸公司账户-杭州商标注册-杭州优创企业 | 深圳VI设计-画册设计-LOGO设计-包装设计-品牌策划公司-[智睿画册设计公司] | 天一线缆邯郸有限公司_煤矿用电缆厂家_矿用光缆厂家_矿用控制电缆_矿用通信电缆-天一线缆邯郸有限公司 | 泰兴市热钻机械有限公司-热熔钻孔机-数控热熔钻-热熔钻孔攻牙一体机 | 一体化污水处理设备,一体化污水设备厂家-宜兴市福源水处理设备有限公司 | 今日扫码_溯源二维码_产品防伪一物一码_红包墙营销方案 | 实体店商新零售|微赢|波后|波后合作|微赢集团 | 手机存放柜,超市储物柜,电子储物柜,自动寄存柜,行李寄存柜,自动存包柜,条码存包柜-上海天琪实业有限公司 | 耐热钢-耐磨钢-山东聚金合金钢铸造有限公司 | 仿真茅草_人造茅草瓦价格_仿真茅草厂家_仿真茅草供应-深圳市科佰工贸有限公司 | 广东护栏厂家-广州护栏网厂家-广东省安麦斯交通设施有限公司 | 珠光砂保温板-一体化保温板-有釉面发泡陶瓷保温板-杭州一体化建筑材料 | Brotu | 关注AI,Web3.0,VR/AR,GPT,元宇宙区块链数字产业 | 苗木价格-苗木批发-沭阳苗木基地-沭阳花木-长之鸿园林苗木场 | 缠绕机|缠绕膜包装机|缠绕包装机-上海晏陵智能设备有限公司 | 法兰螺母 - 不锈钢螺母制造厂家 - 万千紧固件--螺母街 | 网站优化公司_SEO优化_北京关键词百度快速排名-智恒博网络 | 无锡网站建设-做网站-建网站-网页设计制作-阿凡达建站公司 | 洗地机-全自动/手推式洗地机-扫地车厂家_扬子清洁设备 | 中图网(原中国图书网):网上书店,尾货特色书店,30万种特价书低至2折! | 都江堰招聘网-都江堰人才网 都江堰人事人才网 都江堰人才招聘网 邢台人才网_邢台招聘网_邢台123招聘【智达人才网】 | 南汇8424西瓜_南汇玉菇甜瓜-南汇水蜜桃价格| 钢格板_钢格栅_格栅板_钢格栅板 - 安平县鑫拓钢格栅板厂家 | 渗透仪-直剪仪-三轴仪|苏州昱创百科 |