How to secure Bing Maps Key with Razor / Javascript

Thom Gi 0 Reputation points
2023-10-05T04:11:04.67+00:00

Hi,

I am running Bing Maps Demos (https://samples.bingmapsportal.com/) in Visual Studio ASP .NET Core Web Apps. When I swap out the demo codes with my personal Bing Maps Key, that key is visible as plain text in the Javascript.

Please advise of simple methods to hide values like Api keys from being in plain text.

Thanks!

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
835 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dillon Silzer 57,831 Reputation points Volunteer Moderator
    2023-10-05T04:20:18.2833333+00:00

    Hi Thom,

    You can restrict your Bing Maps API Key to an IP address/IP range/domain:

    Announcing Enhanced Security for Bing Maps API Keys

    https://blogs.bing.com/maps/2018-05/Announcing-Enhanced-Security-for-Bing-Maps-API-Keys


    If this is helpful please accept answer.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.