mapbox/mapbox-gl-native-android

Offline downloading fails with HTTP 401 status code

cvb941 opened this issue · 3 comments

Hello,

I have created a custom style using the Mapbox Studio, which contains the mapbox-mapbox-terrain-dem-v1 source, as I aim to read elevation data from it. Here is the link to the style.

Using the style in a MapView works fine, however, when I attempt to use the OfflineManager and OfflineTilePyramidRegionDefinition to create an offline region with this style, the download fails with HTTP status code 401.

Here is an excerpt from logcat:

This request was cancelled (https://a.tiles.mapbox.com/raster/v1/mapbox.mapbox-terrain-dem-v1/1/0/1.png?access_token=*REDACTED*&offline=true). This is expected for tiles that were being prefetched but are no longer needed for the map to render.
2021-05-12 13:01:45.293 24222-24222/sk.lukaskusik.navipilot E/OfflineMapsManager$downloadCountry: onError reason: REASON_OTHER
2021-05-12 13:01:45.293 24222-24222/sk.lukaskusik.navipilot E/OfflineMapsManager$downloadCountry: onError message: HTTP status code 401

Accessing the url https://a.tiles.mapbox.com/raster/v1/mapbox.mapbox-terrain-dem-v1/1/0/1.png?access_token=*REDACTED*&offline=true) in browser returns {"message":"Unauthorized"}

As access_token, I have used my public key and also another key will all of the scopes enabled, with no result.

I have the same issue, did you manage to solve it?
In my case I followed the tutorial at https://docs.mapbox.com/android/maps/guides/offline#download-a-region, and the download seems to start, however after some resources are downloaded it would give me that error.
The issue happens with both big and small offline regions, however the bigger the region the higher is the number of failed request. The fails also seems to happen always at the same "percentage" of my download.

I also made sure that my access token is correct with all the appropiate scopes.

I did not. I hoped either this would get fixed, or I would migrate to the new v10 and try there.

This is affecting us as well via the react-native port. Migrating to the new v10 is unfortunately not an option.