Brahim CHEBBI
Brahim CHEBBI

Reputation: 55

Getting 401 Unauthorized error when installing a pod

I'm setting up a new pod in my pod file and when I do pod install I have an error what should I doing ?

I tried this line to add the pod in my podfile :

pod 'MapboxVisionNativeAll', :podspec => 'https://api.mapbox.com/downloads/v1/vision/ios/mapbox-vision-native-all/0.3.0.podspec?access_token='

this the error

[!] Failed to fetch podspec for MapboxVisionNativeAll at https://api.mapbox.com/downloads/v1/vision/ios/mapbox-vision-native-all/0.3.0.podspec?access_token=<sk.eyJ1IjoiYnJhaGltY2hlYmJpIiwiYSI6ImNqdXlhMXl6aDBmeXo0M3BpYjV6MnFib3IifQ.VinI6ER1YN2nDxXRJzaFXw>. Error: 401 Unauthorized

Upvotes: 2

Views: 4366

Answers (4)

AndyKey
AndyKey

Reputation: 1

In terminal:

  1. touch .netrc
  2. open .netrc
  3. paste below to .netrc with SecretKey
    machine api.mapbox.com
    login mapbox
    password <INSERT SecretKey>
  1. pod install

Note To use your secret token, you will need to store it in a .netrc file in your HOME directory (not your project folder) - https://docs.mapbox.com/ios/maps/guides/install/ (Configure your secret token)*

Upvotes: 0

Malav Bhavsar
Malav Bhavsar

Reputation: 111

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

Upvotes: 11

Carlos M.
Carlos M.

Reputation: 147

This error occurs if the token is invalid.

I tried accessing the link from the error and it says that the token is invalid.

Upvotes: 0

AamirR
AamirR

Reputation: 12198

Following is my working Podfile

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.2'
use_frameworks!

target 'PROJECT_NAME' do
    pod 'MapboxVisionNativeAll', :podspec => 'https://api.mapbox.com/downloads/v1/vision/ios/mapbox-vision-native-all/0.3.0.podspec?access_token=sk.eyJ1IjoiZWRkeXZlcmJydWdnZW4iLCJhIjoiY2p1c3F5eGVpMDA1eTRlbzJpOXJwdDIxMCJ9.OZRITqde9clot1E8Za_OsQ'
end

Upvotes: 0

Related Questions