Cocoapods: Cocoapods Podspec Source HTTP Authentication Support

Created on 18 Mar 2016  路  6Comments  路  Source: CocoaPods/CocoaPods

I am looking into setting up a private repo that allows distributing binary .framework files (so no source code) via Cocoapods.

The actual repo will be hosted on a Git server, just like the Cocoapods page suggests and the actual .framework files will be hosted on a different server that would allow accessing the .framework files via HTTPs.

Let's say I add this in the .podspec file:

spec.source           = { :http => 'https://myhostserver.com/Releases/v1.0.0/MyLibrary.framework.zip' }

From reading the documentation it's not clear to me what kind of authentication does Cocoapods support for referencing the .framework file via HTTPs.

I had a look at both

http://guides.cocoapods.org/making/private-cocoapods.html
https://guides.cocoapods.org/syntax/podspec.html#source

P.S. - I know this is not an Issue but I have already posted on Stackoverflow and also in the Google Groups Forum and I didn't receive a response.
I am just trying to find an answer to this as soon as possible. Sorry if this upsets anyone.

awaiting validation enhancement

Most helpful comment

CocoaPods' Downloader is using CURL for downloading files under the hood. If you want to use HTTP, you can setup your authentication credentials in the ~/.netrc file.

All 6 comments

CocoaPods' Downloader is using CURL for downloading files under the hood. If you want to use HTTP, you can setup your authentication credentials in the ~/.netrc file.

Thank you for your reply.

Unfortunately, I receive a 403 event if I have set my credentials in ~/.netrc

I have used the following command

pod repo push MyRepoName MyFramework.podspec --verbose --allow-warnings

And it produces the following error:

$ /usr/bin/curl -f -L -o /var/folders/x1/ld696pnn7bq6nfwnxlrk8gw00000gp/T/d20160323-15247-1ujke37/file.zip http://jenkins:8080/job/MyFramework/job/iOS_Release/7/artifact/Output/MyFramework.zip --create-dirs
     % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                    Dload  Upload   Total   Spent    Left  Speed

     0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (22) The requested URL returned error: 403 Forbidden

[!] Error installing MyFramework

However if I run the above curl command by also adding the -n option (--netrc) it works.
So I think the way Cocoapods calls curl under the hood doesn't work for me :(

The version of Cocoapods that I'm using is 0.39.0
Please help!

Whoops! It doesn't seem like the downloader actually passed the option -n. I think, it would make sense to do that by default.

As a workaround for now, you might want to create a .curlrc file where you set the option -n by default.

I have ended up creating a separate Git repository and I use as source_url the git repository where I host the .framework and the html documentation as resources.

Hello! Is there any way to make cocoapods available to ask for credentials in the installation process, without using the .netrc-file?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Curtis-Halbrook picture Curtis-Halbrook  路  3Comments

gerchicov-bp picture gerchicov-bp  路  3Comments

iosdev-republicofapps picture iosdev-republicofapps  路  3Comments

tlandsmancars picture tlandsmancars  路  3Comments

Mingmingmew picture Mingmingmew  路  3Comments