BING MAP API Key Protect RRS feed

  • Question

  • I am working in a MVC project with jQuery as Client side script .

    Currently i am using Bing map key in script which is visible to the end user . I want to protect my BingMap key(hide the key to the end user) .Please hep here to resolve this issue 

    Wednesday, August 1, 2018 10:16 AM


All replies

  • Hi Events Organization,

    You should keep your key in the server side script.  See the following sample to create a map:

        function GetMap() {
            map = new Microsoft.Maps.Map('#myMap', {
                credentials: 'YourKey',
                center: new Microsoft.Maps.Location(40.418386, -80.019262),
                zoom: 14



    Wednesday, August 1, 2018 4:02 PM
  • You can look to lock down which clients\domains can use your key by looking at setting enhanced security options on your key.  Here is a link to more details on this feature:


    Tuesday, August 7, 2018 7:55 PM
  • Hi

    What is the recommended way to limit the source of the key request for UWP apps?



    Monday, February 25, 2019 7:07 PM
  • There is no equivalent to domain locking for UWP apps since the requests are made directly from each individual client computer, there is no server involved. It's already more secure than the web, though, as the key is embedded in your application package which is much harder to get to than javascript (which is trivially viewable by any user). If you want additional security, you can encrypt your key during storage in the app package and decrypt it just for map control instantiation.
    Wednesday, February 27, 2019 4:57 PM