Share via

https://atlas.microsoft.com/styling/styles?api-version=2.0&version=2023-01-01&mcv=374 Failed to load resource: the server responded with a status of 403 ()

Ramakrishnan Velu 0 Reputation points
2026-04-24T14:25:13.0766667+00:00

I have tried Azure map loading in ios wkwebiew. its throw the below error

https://atlas.microsoft.com/styling/styles?api-version=2.0&version=2023-01-01&mcv=374
Failed to load resource: the server responded with a status of 403 ()

Reference link:https://learn.microsoft.com/en-us/azure/azure-maps/ios-sdk-migration-guide

Can anyone help on this?

Thank you very much

Azure Maps
Azure Maps

An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.


2 answers

Sort by: Most helpful
  1. Anshika Varshney 10,315 Reputation points Microsoft External Staff Moderator
    2026-04-28T17:35:39.8866667+00:00

    Hi Ramakrishnan Velu,

    From your description, the 403 error on the Azure Maps styling endpoint means the request is being blocked, most likely due to authentication or how the request is being sent from iOS WKWebView.

    Let me explain this in a simple way:

    First, what this error means A 403 error usually means the request is reaching the service, but Azure Maps is not accepting it. This typically happens when the authentication is missing, not valid, or not being passed correctly.

    Second, check authentication carefully Even if you added the subscription key, in WKWebView sometimes it is not applied correctly.

    Please check

    • your subscription key is correct and active
    • the key is actually being passed in the map initialization code
    • there are no script errors preventing the key from being used

    If authentication is not applied correctly, Azure Maps will return 401 or 403 errors, and the map will not load properly.

    Third, test the same page outside iOS This is very important.

    Try opening the same HTML or JavaScript code in

    • Safari browser
    • desktop browser

    If it works there but not in WKWebView, then the issue is not with Azure Maps, but with how WKWebView is loading or handling the request.

    Fourth, check WKWebView behavior WKWebView sometimes behaves differently compared to normal browsers

    Possible things to check

    • headers might not be passed correctly
    • script loading may not complete properly
    • JavaScript errors might stop execution early

    Because of this, the map control may call the styles API without proper authentication attached

    Fifth, check browser console logs Use WKWebView debugging or test in Safari to look at

    • console errors
    • network requests
    • failed API calls

    Sometimes a small JavaScript issue can prevent authentication from being applied correctly.

    Sixth, confirm migration is clean If you moved from native iOS SDK to Web SDK

    Make sure

    • only Web SDK code is used
    • no leftover native SDK configuration exists
    • initialization follows Web SDK pattern fully

    Mixing both approaches can sometimes cause unexpected behavior.

    Simple way to identify the issue

    • if it fails everywhere then it is auth issue
    • if it works in browser but not WKWebView then it is environment issue

    Official reference for setup and migration https://learn.microsoft.com/en-us/azure/azure-maps/ios-sdk-migration-guide

    In short: This error is usually caused by authentication not being applied correctly or WKWebView not sending the request in the expected way Start by validating auth and then compare behavior between browser and WKWebView.

    Hope this helps you narrow down the issue quickly. Do let me know if you have any further queries.

    Thankyou!

    Was this answer helpful?


  2. Q&A Assist
    2026-04-24T14:25:31.6133333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    A 403 on the Azure Maps styles endpoint in a WKWebView indicates that the map control is calling the service without valid/accepted authentication or from a context that the service is blocking. The context provided focuses on migration and troubleshooting but does not include specific iOS/WKWebView auth or CORS details, so only general, supported guidance can be given.

    For this scenario, the following checks are supported by the referenced best-practices guidance for the Web SDK and apply equally when the Web SDK is hosted inside WKWebView:

    1. Ensure authentication is correctly configured
      • The Web SDK requires valid authentication; otherwise, the map will load a blank canvas and return 401/403 errors in the browser (or WKWebView) developer tools.
      • Verify that the authentication options passed to the map (for example, subscription key or other supported auth) are present and valid.
    2. Use Web SDK troubleshooting steps
      • Open the developer tools for the WKWebView (or test the same page in Safari/another browser) and check the console and network tab for errors.
      • Confirm that the map control is initialized correctly and that no JavaScript errors prevent the auth options from being applied.
    3. Test outside WKWebView
      • Load the same HTML/JS page in a regular browser to confirm that the Azure Maps Web SDK and styles endpoint work correctly with the same auth configuration.
      • If it works in the browser but not in WKWebView, the issue is likely related to how WKWebView is configured (for example, headers or script injection not behaving as expected).
    4. Complete migration and cleanup
      • When migrating from the native Azure Maps iOS SDK to a WebView-based implementation, remove all native SDK dependencies and initialization code and ensure the Web SDK is the only map implementation.
      • After migration, perform thorough testing of map functionality, user interactions, and performance to confirm that the Web SDK is working correctly in the iOS environment.

    If, after these checks, the styles endpoint still returns 403 only in WKWebView, further investigation of the exact auth mechanism and WKWebView configuration is required, but that information is not covered in the provided context.


    References:

    Was this answer helpful?

Your answer

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