Coder Social home page Coder Social logo

Comments (4)

weihanglo avatar weihanglo commented on September 25, 2024 1

I got the same error message when the token scope is wrong.

    Updating crates.io index
error: failed to invite owners to crate `sfz` on registry at https://crates.io

Caused by:
  the remote server responded with an error (status 403 Forbidden): must be logged in to perform that action

Seems like crates.io returns the same error for different scenario. For 403 it's fine with returning fewer details, though maybe the error message could be more general?

crates.io/src/auth.rs

Lines 74 to 78 in 0371322

if !self.endpoint_scope_matches(token.endpoint_scopes.as_ref()) {
let error_message = "Endpoint scope mismatch";
request.request_log().add("cause", error_message);
return Err(forbidden());
}

pub fn forbidden() -> BoxedAppError {
let detail = "must be logged in to perform that action";
custom(StatusCode::FORBIDDEN, detail)
}

That said, not sure if it is something wrong in the CLI. That part hasn't changed for a while.

from crates.io.

Turbo87 avatar Turbo87 commented on September 25, 2024 1

I just checked and the API token @metasim has created does not have the change owners token scope, which is most likely why the CLI command failed.

For 403 it's fine with returning fewer details, though maybe the error message could be more general?

yeah, that seems reasonable. we just reused the same error message that we had before token scopes got introduced, but we should probably adjust that to make people aware of that possibility.

from crates.io.

Turbo87 avatar Turbo87 commented on September 25, 2024

/cc @rust-lang/cargo

from crates.io.

weihanglo avatar weihanglo commented on September 25, 2024

Can't reproduce on my side. I've done the followings

  • Tested with cargo version 1.76.0 and 1.77.2
  • Created a change-owner scope token on my account (weihanglo)
  • cargo login with that token
  • cargo owner --add github:rust-tw:jobs-board-maintainers succeeded for my crate sfz
  • Confirmed owner added on crates.io.
  • cargo owner --remove github:rust-tw:jobs-board-maintainers succeeded for my crate sfz
  • Confirmed owner removed on crates.io.

Could you try cargo logout and then cargo login again?

Also need more details from the server side.

from crates.io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.