mapbox / mapbox-navigation-ios

Turn-by-turn navigation logic and UI in Swift on iOS
https://docs.mapbox.com/ios/navigation/
Other
861 stars 314 forks source link

Offline Routing tiles 402 error #4002

Open RRuais opened 2 years ago

RRuais commented 2 years ago

Mapbox Navigation SDK version

2.2.1

Steps to reproduce

When calling Directions.shared.downloadTiles we are getting a 402 response.

`▿ Optional

Defined scopes for our token are as follows:

Screen Shot 2022-07-12 at 13 47 42

OfflineMaps.zip

Expected behavior

When calling Directions.shared.downloadTiles we are expecting a 200 response and should be able to call Directions api while offline.

Actual behavior

When calling Directions.shared.downloadTiles we are getting a 402 response and we are not able to call Directions api while offline to fetch a route.

Is this a one-time issue or a repeatable issue?

repeatable

MaximAlien commented 2 years ago

@RRuais, thanks for sharing additional information. I've just built your project and was able to download tiles successfully with similar access token scopes. Will have to do further debugging to see what might be wrong. Will update this ticket when I have more information.

MaximAlien commented 2 years ago

@RRuais, sorry for a delayed reply. Preferred way of implementing offline functionality for maps and navigation when using Navigation SDK v2.x is using TileStore APIs. We do not have a Navigation SDK guide for that yet, but you can use an Offline API reference provided by Maps SDK at this point.

All stated above is related to non active navigation use case. When it comes to active navigation using NavigationViewController APIs please look at this guide.

The reason you're getting 402 HTTP status code while using Mapbox Directions APIs for offline routing is that it connects to a different endpoint, and to use it additional permissions must be requested on case by case basis.