swift-package-manager: Xcode 14.3 doesn't use credentials (from netrc or keychain) for auth to a package registry
Description
I’d tried to use this solution (self hosted spm registry ) The main thing is - after success auth, utility append new credentials to ~/.netrc file or mac os keychain In my case all credential was appended, but credential getting from netrc or keychain only when i use command line utility If i try to use Xcode, i got auth error status response that means credentials didn’t send. I’ve checked request headers, and exactly as i thought, credential didn’t send
In my case file content seems like that:
.swiftpm/configuration/registries.json
{
"authentication": {
"spm-registry.net": {
"type": "token"
},
},
"registries" : {
"scope" : {
"url" : "https://spm-registry.net/api/spm-registry/"
}
},
"version" : 1
}
~/.netrc
machine spm-registry.net
login token
password <TOKEN>
Expected behavior
Xcode use credentials from netrc or keychain
Actual behavior
Credential was used only when i run cmd utility
Steps to reproduce
- Install Xcode 14.3
- Setup registries url by command line
- Setup registries auth by command line
- Run your self-hosted spm registry
- Try to resolve dependencies by Xcode application
Swift Package Manager version/commit hash
No response
Swift & OS version (output of swift --version && uname -a
)
###############################
$ swift --version
swift-driver version: 1.75.2 Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100)
Target: arm64-apple-macosx13.0
###############################
$ swift package --version
Swift Package Manager - Swift 5.8.0
###############################
$ system_profiler SPSoftwareDataType
Software:
System Software Overview:
System Version: macOS 13.1 (22C65)
Kernel Version: Darwin 22.2.0
...
###############################
$ system_profiler SPDeveloperToolsDataType
Developer:
Developer Tools:
Version: 14.3 (14E222b)
Location: /Applications/Xcode.app
Applications:
Xcode: 14.3 (21812)
Instruments: 14.3 (64559.163)
...
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 4
- Comments: 30 (15 by maintainers)
@FirstAM The fix is in Xcode. We will post back here when it becomes available.
Seems to be included in the Xcode 15 Beta!
@lukepistrol Yep!
@yim-lee Can you confirm this will be available in a Xcode 14.x.x update or is it more likely this will be available only in the upcoming Xcode 15 beta?
new issue is created: https://github.com/apple/swift-package-manager/issues/7237
@ncharniauski Can you create a new issue detailing the steps it takes to reproduce the issue? Please include example of values you enter in the UI. e.g., do you type in Artifactory URL or package identifier?
@yim-lee The multiple credentials issue repeatedly happened to me. I also was unable to connect to an authenticated repo with Xcode 15. I’ve found that this problem seems to be due to upgrading from Xcode 14 to Xcode 15. I’ve installed Xcode through the App Store and was constantly having these problems. Once I deleted Xcode, and also deleted Xcode settings files like
com.apple.dt.Xcode
in locations like~/Library/Application Scripts
,~/Library/Preferences
,~/Library/Containers
,~/Library/Developer
, and~/Library/Saved Application State
followed by a reinstall of Xcode directly from the App Store, both of my problems disappeared and I stopped getting duplicate credentials in keychain and was able to connect to the authenticated repo.