Pub: Unclear how to change my pub account, and unclear what account is in use

Created on 6 Jun 2015  路  11Comments  路  Source: dart-lang/pub

Issue by sethladd
_Originally opened as dart-lang/sdk#20201_


Consider this workflow:

A user has two accounts with Google.
Using one of the accounts, they publish something to pub.
Many months later, they want to publish from a different account.

Expected: an obvious way to tell publish which account to use and/or switch accounts.

Actual: this error message:

"You aren't an uploader for package 'coolbeans'."

Workaround:

Try deleting .pub-cache/credentials/json. Then try again.

Suggestion:

pub authorize
pub deauthorize

  • include a message like "<current email> isn't an uploader for package coolbeans. To change the account, do ____________"

Thanks!

enhancement

Most helpful comment

@sigurdm, I think we could introduce:

$ pub login
.... open this URL in your browser and sign-in ....
You are now signed in as: [email protected]

$ pub login
You are already signed-in as: [email protected]
Use: `pub logout` to sign out, before you can login again.

$ pub logout
You are not signed out.

I filed https://github.com/dart-lang/pub/issues/2467. @sigurdm feel free to close if you disagree.

All 11 comments

Comment by sethladd


_Changed the title to: "Unclear how to change my pub account, and unclear what account is in use"._

That's true, how can we change account with pub ? having a pub login/logout would be nice

I guess you can add a new uploader and then remove the old one.

Yeah but not really user friendly... don't really want to publish a lib with my work account and then switch back to mine as it send an email when package is uploaded (meaning all the dev team will receive it...).
Is there any other way or is it the only one ?

For now I removed .pub-cache/credentials.json and it ask me to log again.

You can backup .pub-cache/credentials.json and then copy the one back to .pub-cache/credentials.json that you want to use right now. Sure it's not user friendly, but it's not blocking either.

How do you login after you logout?

When you run pub publish it will take you though the login flow.

I'm not confident this issue should be closed. Having a logout command without a login command seems strange and doesn't make using your pub account or accounts more clear, in my opinion.

Additionally a way to check which account is currently logged in would round out and resolve this issue completely.

@jonasfj do we want to do something more here?

@sigurdm, I think we could introduce:

$ pub login
.... open this URL in your browser and sign-in ....
You are now signed in as: [email protected]

$ pub login
You are already signed-in as: [email protected]
Use: `pub logout` to sign out, before you can login again.

$ pub logout
You are not signed out.

I filed https://github.com/dart-lang/pub/issues/2467. @sigurdm feel free to close if you disagree.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kasperpeulen picture kasperpeulen  路  27Comments

samueladekunle picture samueladekunle  路  25Comments

crajygemer picture crajygemer  路  24Comments

devoncarew picture devoncarew  路  30Comments

sinadarvi picture sinadarvi  路  24Comments