mapbox / mapbox/mapbox-navigation-android
RouteOptions.baseUrl not respecting Basic Authentication credentials in URL
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 651
- Forks
- 321
- PR merge metrics
- No merged PRs in 30d
Description
**Android API: 31 **
**Mapbox Navigation SDK version: 2.3.0**
### Steps to trigger behavior
Here's a minimal example, allthough the real usecase for having a Basic Authentication is different.
It uses Docker to simulate a web server running locally with a proxy pass to Mapbox's API and an Android Emulator running on the same machine.
1. Setup a nginx-Docker with Basic Authentication for "location /" and a pass through proxy to Mapbox
`location / {
auth_basic "Protected Area";
auth_basic_user_file /var/htpasswd;
proxy_pass https://api.mapbox.com;
}`
2. Content of /var/htpasswd is `user:$apr1$0lk63gex$zT8La3WSbV1NWY/JOQiOE1 `
That is both "user" for username and password
3. Following the instructions to create a workin Android Demo using version 2.3.0 of Mapbox Navigation SDK for Android and add the following baseUrl when requesting routes `.baseUrl("http://user:user@10.0.2.2")`. When running on Android Emulator 10.0.2.2 points to the localhost of the host (e.g. the machine that also runs the nginx docker)
4. Enable logging via` .isDebugLoggingEnabled(true)` when creating MapboxNavigationProvider
### Expected behavior
A successful route description from Mapbox as if baseUrl was not set.
### Actual behavior
Getting a 401 from Nginx. From the Mapbox Navigation SDK Logs:
`Directions Service: Get route response:
401 Authorization Required
401 Authorization Required
nginx/1.21.6
with code 401`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at RouteOptions.baseUrl handling and the route request construction in the Android SDK. Reproduce the request through the nginx Docker proxy using the provided URL credentials and Android emulator setup. Done means the configured credentials are sent and the request returns a successful route instead of nginx's 401 response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, docker, kotlin
- Domain
- api, mobile, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100