-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Publish to self hosted pub server - 401 on upstream version check #3282
Comments
As I understand it the bug here is that we treat the 401 after a redirect as belonging to the redirecting server, and removes the invalid credentials belonging to that, even though we should be looking at the credentials for the redirectee. I think that sounds very sensible. |
Yeah, that's pretty much it. And when the pub client receives redirect to |
Only if it was redirected there from |
Maybe the error message could be better... but you're contacting pub.dev with a token that isn't valid. Authentication failed. An error code is correct, maybe it should say "authentication failed" instead, make a reproducible example, and file an issue at https://github.com/dart-lang/pub-dev |
I don't think we can help with unpub issues. A specification for writing custom pub servers is available here: If you have any questions or concerns regarding it, please feel free to open an issue. |
Or ping me in #hackers-pub-dev-📦 https://github.com/flutter/flutter/wiki/Chat |
Filed dart-lang/pub-dev#5436 for a prettier message from pub.dev |
Reading the source around pub/lib/src/authentication/client.dart Line 46 in 1e78c68
|
pub version
orflutter pub version
: Pub 2.16.0-80.1.betaI am using unpub server, but when I want to publish my package to it using the
dart pub publish
, it fails.I add my token using
dart pub token add https://pub.mydomain.xy/ <token>
and verify everything is ok.pub publish
first tries to check published versions by callingGET https://pub.mydomain.xy/api/packages/test_package
.But when it doesn't exist on my server, it returns 302 with the upstream package url (as seen here).
cURL response:
Now the pub client tries to check the upstream URL, gets 401 and the token get's removed (I believe by this).
I tried to check
GET https://pub.dev/api/packages/oauth2
manually with my token and got a HTML response with this, is this even right?Without any
Authorization
header I get 200, but with theAuthorization
header it returns that the header is not there at all.When I re-add that token right before the actual package upload, it proceeds fine.
Logs:
here I see in my server logs 302, so it must've tried to check the official pub.dev
and my token is gone
Now since
pub-tokens.json
is empty now, it would fail.But since it's waiting for my input, I can re-run
dart pub token add https://pub.mydomain.xy/
and the rest of the process continues successfully.But I'm not sure if this is pub client, pub server or unpub issue, because I don't know what should actually happen:
Authorization
header errorEDIT: I missed this unpub PR, where they disable upstream check and return 404. But I'm still curious about the idea of preventing overlapping packages...
The text was updated successfully, but these errors were encountered: