mapbox-gl-native icon indicating copy to clipboard operation
mapbox-gl-native copied to clipboard

Can't update to latest sdk version: 401 unauthorized error in cocoapods

Open klundberg opened this issue 4 years ago • 14 comments

I can't seem to download the latest mapbox sdk, as I get a 401 error when I try.

Steps to reproduce

  1. 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

klundberg avatar Jan 20 '21 22:01 klundberg

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.

frederoni avatar Jan 21 '21 08:01 frederoni

=> 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).

  1. In terminal type: cd ~
  2. touch .netrc
  3. open .netrc
  4. paste below to .netrc with SecretKey machine api.mapbox.com login mapbox password <INSERT SecretKey>
  5. Enjoy: pod install will work without error

ghost avatar Feb 24 '21 05:02 ghost

=> 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).

  1. In terminal type: cd ~
  2. touch .netrc
  3. open .netrc
  4. paste below to .netrc with SecretKey machine api.mapbox.com login mapbox password
  5. Enjoy: pod install will work without error

This worked. Thanks

developsolutions avatar May 13 '21 08:05 developsolutions

Having trouble doing this on CodeMagic.

treehousetim avatar Jan 20 '22 21:01 treehousetim

It turns out my API key also needs the "Downloads:read" scope. The .netrc file was what I was missing, thanks.

learner-long-life avatar Jun 20 '22 00:06 learner-long-life

I did it but not working. My mac is Macbook-Pro Ventura. not sure whether it's os problem or not. Please help me

vadim312 avatar Feb 24 '23 07:02 vadim312

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.

nitishxyz avatar Mar 11 '23 05:03 nitishxyz

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

lanserxt avatar Mar 13 '23 09:03 lanserxt

It's a problem probably with macOS Ventura 13.2.1. The installation succeeds on the 13.2.0 and previous versions.

nitishxyz avatar Mar 13 '23 10:03 nitishxyz

I have the same issue. macOS Ventura 13.2.1. Please help

sleushunou avatar Mar 15 '23 10:03 sleushunou

@nitishxyz @sleushunou this solution still worked for me on macOS Ventura 13.2.1

sebipirpi avatar Mar 15 '23 11:03 sebipirpi

It works. Thanks!

sleushunou avatar Mar 15 '23 11:03 sleushunou

I faced the same issue and the problem was that there was no empty line at the end of the .netrc file.

shunta0213 avatar Mar 29 '23 15:03 shunta0213

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

benhulan avatar Jul 29 '23 15:07 benhulan