mapbox / mapbox-gl-native-android

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
218 stars 114 forks source link

Offline downloading fails with HTTP 401 status code #670

Open cvb941 opened 3 years ago

cvb941 commented 3 years ago

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.

LorenzoFerri commented 3 years ago

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.

cvb941 commented 3 years ago

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

sedot42 commented 3 years ago

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