mapbox-gl-native
mapbox-gl-native copied to clipboard
Can't update to latest sdk version: 401 unauthorized error in cocoapods
I can't seem to download the latest mapbox sdk, as I get a 401 error when I try.
Steps to reproduce
- update podfile (if needed) to point pod to at least 6.3
2.run
pod update
I haven't tried running this with other versions, only with the latest available sdk.
Expected behavior
Pod should install successfully
Actual behavior
I get the following output from cocoapods:
[!] Error installing Mapbox-iOS-SDK
[!] /usr/bin/curl -f -L -o /var/folders/9l/frjl6hvs3wsfxfhskqmjqzv00000gp/T/d20210120-44504-1lr76ns/file.zip https://api.mapbox.com/downloads/v2/mobile-maps/releases/ios/packages/6.3.0/mapbox-ios-sdk-dynamic.zip --create-dirs --netrc-optional --retry 2 -A 'CocoaPods/1.10.1 cocoapods-downloader/1.4.0'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (22) The requested URL returned error: 401 Unauthorized
Configuration
Mapbox SDK versions: 6.3 iOS/macOS versions: macos 10.15.7 Device/simulator models: n/a Xcode version: 12.3
Check the CocoaPods installation steps here https://github.com/mapbox/mapbox-gl-native-ios/blob/d89e7139e5f6a9a3ea5ad57782b41579b8a0bbb1/platform/ios/INSTALL.md#cocoapods
You need to create a token on https://mapbox.com before downloading.
=> I guess, You are misplacing your .netrc. => The .netrc file should be in your home directory (~ on the command line, or use Go ‣ Home in Finder).
- In terminal type: cd ~
- touch .netrc
- open .netrc
- paste below to .netrc with SecretKey machine api.mapbox.com login mapbox password <INSERT SecretKey>
- Enjoy: pod install will work without error
=> I guess, You are misplacing your .netrc. => The .netrc file should be in your home directory (~ on the command line, or use Go ‣ Home in Finder).
- In terminal type: cd ~
- touch .netrc
- open .netrc
- paste below to .netrc with SecretKey machine api.mapbox.com login mapbox password
- Enjoy: pod install will work without error
This worked. Thanks
Having trouble doing this on CodeMagic.
It turns out my API key also needs the "Downloads:read" scope. The .netrc
file was what I was missing, thanks.
I did it but not working. My mac is Macbook-Pro Ventura. not sure whether it's os problem or not. Please help me
It was working for me before upgrading to the lates macOS version 13.2.1, after that it always throws an 401 error, tried even creating new token and using that in .netrc
. Nothing works.
Same issue with macOS version 13.2.1
[!] Error installing Mapbox-iOS-SDK [!] /usr/bin/curl -f -L -o /var/folders/js/x2c996yn7cl1yktydcbgvz_h0000gn/T/d20230313-6917-1yauaf7/file.zip https://api.mapbox.com/downloads/v2/mobile-maps/releases/ios/packages/6.3.0/mapbox-ios-sdk-dynamic.zip --create-dirs --netrc-optional --retry 2 -A 'CocoaPods/1.11.3 cocoapods-downloader/1.5.1'
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 39 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (22) The requested URL returned error: 401
It's a problem probably with macOS Ventura 13.2.1. The installation succeeds on the 13.2.0 and previous versions.
I have the same issue. macOS Ventura 13.2.1. Please help
@nitishxyz @sleushunou this solution still worked for me on macOS Ventura 13.2.1
It works. Thanks!
I faced the same issue and the problem was that there was no empty line at the end of the .netrc
file.
If you had the 401, implemented the .netrc
fix now you are getting a 403 error, make sure you added DOWNLOADS:READ
permissions when creating the secret token (and do not use your default token for this). https://stackoverflow.com/questions/66648473/mapbox-ios-sdk-6-3-0-pod-install-error-403-forbidden