Skip to content

Commit 738e7ab

Browse files
mfazekasclaude
andauthored
feat: make Mapbox SDK authentication optional (#4012)
* feat: make Mapbox SDK authentication optional • Remove mandatory authentication requirement for Mapbox SDK downloads • Update build.gradle files to make MAPBOX_DOWNLOADS_TOKEN optional • Remove .netrc setup from iOS CI workflow • Make gradle.properties setup optional in Android CI workflow • Update Expo plugin to make authentication optional • Update documentation to reflect optional authentication This change aligns with Mapbox's removal of download token requirements as mentioned in: mapbox/mapbox-maps-flutter#775 The authentication is kept optional for backward compatibility. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: remove download token steps and comments from CI workflows • Remove all MAPBOX_DOWNLOAD_TOKEN related steps from Android and iOS CI workflows • Remove download token secrets from workflow definitions • Remove explanatory comments since they're no longer needed • Clean up CI to be simpler since authentication is no longer required 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * docs: simplify installation documentation by removing authentication steps • Remove complex authentication setup from Android installation guide • Remove authentication setup from iOS installation guide • Add simple note explaining Mapbox removed auth requirement • Simplify maven repo configuration to just URL • Make documentation more user-friendly and easier to follow This reflects the new reality that Mapbox SDK downloads no longer require authentication tokens, making the setup process much simpler for developers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: correct MAPBOX_ACCESS_TOKEN secret in ci-for-forked-repos - Remove ENV_MAPBOX_ACCESS_TOKEN and use MAPBOX_ACCESS_TOKEN directly - This matches the secret expected by ci-requiring-tokens workflow - Remove unnecessary ENV_MAPBOX_DOWNLOAD_TOKEN secret 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * remove MAPBOX_DOWNLOAD_TOKEN from ci --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent b07c551 commit 738e7ab

File tree

11 files changed

+46
-92
lines changed

11 files changed

+46
-92
lines changed

.github/workflows/android-actions.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,8 @@ on:
2626
secrets:
2727
MAPBOX_ACCESS_TOKEN:
2828
required: true
29-
MAPBOX_DOWNLOAD_TOKEN:
30-
required: true
3129
ENV_MAPBOX_ACCESS_TOKEN:
3230
required: false
33-
ENV_MAPBOX_DOWNLOAD_TOKEN:
34-
required: false
3531

3632
jobs:
3733
build_example:
@@ -60,13 +56,7 @@ jobs:
6056
distribution: 'zulu'
6157
java-version: '17'
6258

63-
- run: |
64-
mkdir -p ~/.gradle/
65-
echo MAPBOX_DOWNLOADS_TOKEN=$MAPBOX_DOWNLOAD_TOKEN > ~/.gradle/gradle.properties
66-
working-directory: example
67-
env:
68-
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN || secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}
69-
59+
7060
- run: echo $MAPBOX_ACCESS_TOKEN > ./accesstoken
7161
working-directory: example
7262
env:

.github/workflows/ci-for-forked-repos.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@ jobs:
1212
env_name: CI with Mapbox Tokens
1313
ref: ${{ github.event.pull_request.head.sha }}
1414
secrets:
15-
ENV_MAPBOX_ACCESS_TOKEN: ${{ secrets.ENV_MAPBOX_ACCESS_TOKEN }}
16-
ENV_MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}
15+
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
1716

.github/workflows/ci-requiring-tokens.yml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,10 @@ on:
1616
secrets:
1717
MAPBOX_ACCESS_TOKEN:
1818
required: false
19-
MAPBOX_DOWNLOAD_TOKEN:
20-
required: false
2119
ENV_MAPBOX_ACCESS_TOKEN:
2220
required: false
23-
ENV_MAPBOX_DOWNLOAD_TOKEN:
24-
required: false
2521

26-
concurrency:
22+
concurrency:
2723
group: ${{ github.head_ref || github.run_id }}-ci-with-tokens
2824
cancel-in-progress: true
2925

@@ -38,9 +34,7 @@ jobs:
3834
MAP_IMPL: mapbox
3935
secrets:
4036
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
41-
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN }}
4237
ENV_MAPBOX_ACCESS_TOKEN: ${{ secrets.ENV_MAPBOX_ACCESS_TOKEN }}
43-
ENV_MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}
4438

4539
call_android_workflow_fabric:
4640
name: "Android/Mapbox/Fabric"
@@ -53,9 +47,7 @@ jobs:
5347
NEW_ARCH: true
5448
secrets:
5549
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
56-
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN }}
5750
ENV_MAPBOX_ACCESS_TOKEN: ${{ secrets.ENV_MAPBOX_ACCESS_TOKEN }}
58-
ENV_MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}
5951

6052

6153
call_android_workflow_11:
@@ -68,9 +60,7 @@ jobs:
6860
MAP_IMPL: mapbox11
6961
secrets:
7062
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
71-
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN }}
7263
ENV_MAPBOX_ACCESS_TOKEN: ${{ secrets.ENV_MAPBOX_ACCESS_TOKEN }}
73-
ENV_MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}
7464

7565
call_ios_workflow:
7666
name: "iOS/Mapbox"
@@ -82,9 +72,7 @@ jobs:
8272
MAP_IMPL: mapbox
8373
secrets:
8474
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
85-
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN }}
8675
ENV_MAPBOX_ACCESS_TOKEN: ${{ secrets.ENV_MAPBOX_ACCESS_TOKEN }}
87-
ENV_MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}
8876

8977
call_ios_workflow_fabric:
9078
name: "iOS/Mapbox/Fabric"
@@ -97,9 +85,7 @@ jobs:
9785
NEW_ARCH: true
9886
secrets:
9987
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
100-
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN }}
10188
ENV_MAPBOX_ACCESS_TOKEN: ${{ secrets.ENV_MAPBOX_ACCESS_TOKEN }}
102-
ENV_MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}
10389

10490
call_ios_workflow_11:
10591
name: "iOS/Mapbox11"
@@ -111,10 +97,8 @@ jobs:
11197
MAP_IMPL: mapbox11
11298
secrets:
11399
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
114-
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN }}
115100
ENV_MAPBOX_ACCESS_TOKEN: ${{ secrets.ENV_MAPBOX_ACCESS_TOKEN }}
116-
ENV_MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}
117-
101+
118102
call_web_workflow:
119103
name: "Web/Mapbox"
120104
uses: ./.github/workflows/web-actions.yml
@@ -124,6 +108,4 @@ jobs:
124108
NVMRC: ${{ inputs.NVMRC }}
125109
secrets:
126110
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
127-
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN }}
128111
ENV_MAPBOX_ACCESS_TOKEN: ${{ secrets.ENV_MAPBOX_ACCESS_TOKEN }}
129-
ENV_MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}

.github/workflows/ios-actions.yml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,8 @@ on:
2626
secrets:
2727
MAPBOX_ACCESS_TOKEN:
2828
required: true
29-
MAPBOX_DOWNLOAD_TOKEN:
30-
required: true
3129
ENV_MAPBOX_ACCESS_TOKEN:
3230
required: false
33-
ENV_MAPBOX_DOWNLOAD_TOKEN:
34-
required: false
3531

3632
jobs:
3733
build:
@@ -60,16 +56,7 @@ jobs:
6056
env:
6157
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN || secrets.ENV_MAPBOX_ACCESS_TOKEN }}
6258

63-
- name: Setup .netrc with MAPBOX_DOWNLOAD_TOKEN
64-
run: |
65-
echo 'machine api.mapbox.com' >> ~/.netrc
66-
echo 'login mapbox' >> ~/.netrc
67-
echo "password $MAPBOX_DOWNLOAD_TOKEN" >> ~/.netrc
68-
chmod 0600 ~/.netrc
69-
if: "${{ env.MAPBOX_DOWNLOAD_TOKEN != '' }}"
70-
env:
71-
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN || secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }}
72-
59+
7360
- name: Setup node ${{ inputs.NVMRC }}
7461
uses: actions/setup-node@v3.5.1
7562
with:

.github/workflows/on-push.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ jobs:
7777
if: needs.has_mapbox_token.outputs.has-mapbox-token == 'true'
7878
secrets:
7979
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
80-
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN }}
8180

8281
publish:
8382
if: startsWith(github.ref, 'refs/tags/') && (github.event_name == 'push')

.github/workflows/web-actions.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,15 @@ on:
99
type: string
1010
ref:
1111
required: false
12-
type: string
12+
type: string
1313
NVMRC:
1414
required: true
1515
type: string
1616
secrets:
1717
MAPBOX_ACCESS_TOKEN:
1818
required: true
19-
MAPBOX_DOWNLOAD_TOKEN:
20-
required: true
2119
ENV_MAPBOX_ACCESS_TOKEN:
2220
required: false
23-
ENV_MAPBOX_DOWNLOAD_TOKEN:
24-
required: false
2521

2622
jobs:
2723
build_example:
@@ -32,7 +28,7 @@ jobs:
3228
- name: Checkout
3329
uses: actions/checkout@v4
3430
if: ${{ inputs.ref == '' }}
35-
31+
3632
- name: Checkout fork
3733
uses: actions/checkout@v4
3834
if: ${{ inputs.ref != '' }}
@@ -56,4 +52,4 @@ jobs:
5652
working-directory: example
5753

5854
- run: npx expo export --platform web
59-
working-directory: example
55+
working-directory: example

android/install.md

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22

33
## Supported mapbox libraries
44

5-
We're only supporting mapbox 10.16* and 11.*. The default is 10.16*.
5+
We're only supporting mapbox 10.16* and 11.*. The default is 10.16*.
66
Next release will be 11.* only so we recommend updatign to 11.*
77

88
### Adding mapbox maven repo
99

10-
You will need to authorize your download of the Maps SDK via a secret access token with the `DOWNLOADS:READ` scope.
11-
This [guide](https://docs.mapbox.com/android/maps/guides/install/#configure-credentials) explains how to `Configure credentials` and `Configure your secret token`.
12-
1310
Then under section `allprojects/repositories` add your data:
1411

1512
```groovy
@@ -20,22 +17,14 @@ allprojects {
2017
// ...other repos
2118
maven {
2219
url 'https://api.mapbox.com/downloads/v2/releases/maven'
23-
authentication {
24-
basic(BasicAuthentication)
25-
}
26-
credentials {
27-
// Do not change the username below.
28-
// This should always be `mapbox` (not your username).
29-
username = 'mapbox'
30-
// Use the secret token you stored in gradle.properties as the password
31-
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
32-
}
3320
}
3421
// ...even more repos?
3522
}
3623
}
3724
```
3825

26+
*Note:* mapbox lifted auth requirement from downloads so MAPBOX_DOWNLOADS_TOKEN is no longer needed
27+
3928
### Using non default mapbox version
4029

4130
*Warning*: If you set a custom version, make sure you revisit, any time you update @rnmapbox/maps. Setting it to earlier version than what we exepect will likely result in a build error.

example/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ cd example
5757
* Android: Set up your Mapbox developer keys as described in https://github.com/rnmapbox/maps/blob/main/android/install.md#adding-mapbox-maven-repo (no need to change build.gradle, just set up gradle.properties)
5858

5959
* iOS:
60-
1. Set up your Mapbox developer keys as described in [https://github.com/rnmapbox/maps/blob/main/ios/install.md#adding-mapbox-maven-repo](https://github.com/rnmapbox/maps/blob/main/ios/install.md#mapbox-maps-sdk-v10) (add your cerdentials to .netrc as described)
61-
2. Install pod dependencies
60+
1. Install pod dependencies
6261
```
6362
cd ios
6463
pod install

example/android/build.gradle

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,20 @@ allprojects {
5454

5555
maven {
5656
url 'https://api.mapbox.com/downloads/v2/releases/maven'
57-
authentication {
58-
basic(BasicAuthentication)
59-
}
60-
credentials {
61-
// Do not change the username below.
62-
// This should always be `mapbox` (not your username).
63-
username = 'mapbox'
64-
// Use the secret token you stored in gradle.properties as the password
65-
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
57+
// Authentication is no longer required as per Mapbox's removal of download token requirement
58+
// See: https://github.com/mapbox/mapbox-maps-flutter/issues/775
59+
// Keeping this as optional for backward compatibility
60+
if (project.properties['MAPBOX_DOWNLOADS_TOKEN']) {
61+
authentication {
62+
basic(BasicAuthentication)
63+
}
64+
credentials {
65+
// Do not change the username below.
66+
// This should always be `mapbox` (not your username).
67+
username = 'mapbox'
68+
// Use the secret token you stored in gradle.properties as the password
69+
password = project.properties['MAPBOX_DOWNLOADS_TOKEN']
70+
}
6671
}
6772
}
6873
}

plugin/build/withMapbox.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,16 @@ allprojects {
211211
repositories {
212212
maven {
213213
url 'https://api.mapbox.com/downloads/v2/releases/maven'
214-
authentication { basic(BasicAuthentication) }
215-
credentials {
216-
username = 'mapbox'
217-
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: System.getenv('RNMAPBOX_MAPS_DOWNLOAD_TOKEN') ?: {
218-
throw new GradleException('❌ RNMapbox Maps Error: Mapbox download token is required.\\nSet RNMAPBOX_MAPS_DOWNLOAD_TOKEN environment variable:\\n export RNMAPBOX_MAPS_DOWNLOAD_TOKEN="sk.ey...qg"\\n npx expo prebuild\\n\\nOr use deprecated config:\\n RNMapboxMapsDownloadToken in app.json plugin config')
219-
}()
214+
// Authentication is no longer required as per Mapbox's removal of download token requirement
215+
// See: https://github.com/mapbox/mapbox-maps-flutter/issues/775
216+
// Keeping this as optional for backward compatibility
217+
def token = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: System.getenv('RNMAPBOX_MAPS_DOWNLOAD_TOKEN')
218+
if (token) {
219+
authentication { basic(BasicAuthentication) }
220+
credentials {
221+
username = 'mapbox'
222+
password = token
223+
}
220224
}
221225
}
222226
}

0 commit comments

Comments
 (0)