繁体   English   中英

隐藏谷歌 Map API 键入 Blazor WASM 应用程序

[英]Hide Google Map API Key in Blazor WASM application

我有一个使用 Google Map API 的 Blazor WASM 应用程序。按照说明,除了 Google Map API 外,它的所有功能都在 wwwroot\Index.html 中公开。 我希望将其移出 index.html,但我不清楚是否应该设置密钥。

<-- Index.html -->
<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <base href="/" />
    <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
    <link href="css/app.css" rel="stylesheet" />
    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=<My Google API Key>=initMap"></script>```

这不是具体的 Blazor 问题。 但是,根据您问题中的评论,您可以在您的谷歌云平台中添加网站或 IP 限制。 Go 到您生成 API 密钥的页面。 所以即使有人有你的 API 密钥,他们也不能在他们的网站上使用它。

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM