'How to change uploader of flutter package
I have uploaded a package with an email and then I changed to another email. So in order to replace email I've added by using pub uploader add [email protected]. and when I try to remove old email it displays the following error
pub uploader remove [email protected]
Self-removal is not allowed. Use another account to remove this email address.
for this issue I searched to fix and found deleted .pub_cache/credentials.json will resolve but I cannot found that file in .pub-cache directory. I want to how to remove old email.
Solution 1:[1]
I found answer by myself. Since there is no options like select uploader or logout pub authentication, we need revoke authentication in google. So that while publishing the package it will ask for authentication and that time we can provide new email. Let me explain all these.
First I uploaded a package to pub.dev by using [email protected] but I want to change to [email protected]. So inorder to do this, we have to add [email protected] to the package first. To do that
pub uploader add [email protected]
After adding in web browser go to my account.google.com -> security -> manage third party access -> remove pub.dartlang.org.
after revoking access to old account in terminal publish the package again and it will ask for authentication, now login with [email protected] and then type
pub uploader remove [email protected]
Now changed the publisher successfully.
Solution 2:[2]
Right now the steps you mention above are generating the following error: {"code":"MissingAuthentication","message":"authenication is required, please add authorization header."}
For an updated approach do the following:
- Add the new uploader with
flutter pub uploader add <[email protected]>
- Remove the previous uploader with
flutter pub uploader remove <[email protected]>
- Remove saved credentials using
flutter pub logout
orrm ~/Library/Application Support/dart/pub-credentials.json
. - Finally type
flutter pub publish
and allow access from your navigator.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mohamed Al Ameen |
Solution 2 | Benjamín Cáceres Ramirez |