Nadia Ghebreial
Nadia Ghebreial

Reputation: 166

Flutter packages pub - UnauthorizedAccess: Unauthorized user: ... is not allowed to upload versions to package

I'm trying to publish a new flutter plugin. I followed all the steps to publish my package, my code is uploaded to github: flutter_image_share and everything is ready to be published.

When I run flutter packages pub publish I get this response:

Pub needs your authorization to upload packages on your behalf.
In a web browser, go to https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&response_type=code&client_id=818368855108-8grd2eg9tj9f38os6f1urbcvsq399u8n.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A35625&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email
Then click "Allow access".

I go to the link, I authenticate with my google account and in the end I get this result:

Waiting for your authorization...
Authorization received, processing...
Successfully authorized.
Uploading...
UnauthorizedAccess: Unauthorized user: [email protected] is not allowed to upload versions to package flutter_share_image..

After that I run this command: rm ~/.pub-cache/credentials.json to delete the credentials.json and pub uploader add [email protected] --verbosity=all to give permissions to this email but I get this response:

FINE: Pub 2.1.0-dev.9.4.flutter-f9ebf21297
FINE: Loading OAuth2 credentials.
MSG : Pub needs your authorization to upload packages on your behalf.
    | In a web browser, go to https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&response_type=code&client_id=818368855108-8grd2eg9tj9f38os6f1urbcvsq399u8n.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A37441&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email
    | Then click "Allow access".
    | 
    | Waiting for your authorization...
MSG : Authorization received, processing...
IO  : HTTP POST https://accounts.google.com/o/oauth2/token
    | content-type: application/x-www-form-urlencoded; charset=utf-8
    | user-agent: Dart pub 2.1.0-dev.9.4.flutter-f9ebf21297
IO  : HTTP response 200 OK for POST https://accounts.google.com/o/oauth2/token
    | took 0:00:00.205821
    | alt-svc: quic=":443"; ma=2592000; v="44,43,39"
    | cache-control: private
    | transfer-encoding: chunked
    | date: Fri, 25 Jan 2019 11:03:58 GMT
    | vary: Origin,X-Origin,Referer
    | content-encoding: gzip
    | x-frame-options: SAMEORIGIN
    | content-type: application/json; charset=utf-8
    | x-xss-protection: 1; mode=block
    | x-content-type-options: nosniff
    | server: ESF
MSG : Successfully authorized.
IO  : HTTP POST https://pub.dartlang.org/api/packages/flutter_share_image/uploaders
    | Accept: application/vnd.pub.v2+json
    | content-type: application/x-www-form-urlencoded; charset=utf-8
    | authorization: <censored>
    | user-agent: Dart pub 2.1.0-dev.9.4.flutter-f9ebf21297
IO  : HTTP response 403 Forbidden for POST https://pub.dartlang.org/api/packages/flutter_share_image/uploaders
    | took 0:00:00.286149
    | transfer-encoding: chunked
    | date: Fri, 25 Jan 2019 11:03:59 GMT
    | content-encoding: gzip
    | vary: Accept-Encoding
    | via: 1.1 google
    | content-type: application/json
    | x-frame-options: SAMEORIGIN
    | x-xss-protection: 1; mode=block
    | x-content-type-options: nosniff
    | server: dart:io with Shelf
FINE: Saving OAuth2 credentials.
IO  : Writing 400 characters to text file /home/nadia/.pub-cache/credentials.json.
ERR : Unauthorized request.
FINE: Exception type: ApplicationException
FINE: package:pub/src/utils.dart 571:5             fail
    | package:pub/src/http.dart 302:3              handleJsonError
    | package:pub/src/command/uploader.dart 78:32  UploaderCommand.run.<fn>
    | dart:async                                   _AsyncAwaitCompleter.completeError
    | package:http/src/base_client.dart            BaseClient._sendUnstreamed
    | ===== asynchronous gap ===========================
    | dart:async                                   Future.catchError
    | package:pub/src/command/uploader.dart 78:10  UploaderCommand.run
    | package:args/command_runner.dart 194:27      CommandRunner.runCommand

I don't know if I am doing something wrong. Does anyone know how can I upload my package? I want to publish two new packages and I am not able to do that.

Upvotes: 2

Views: 3749

Answers (1)

G&#252;nter Z&#246;chbauer
G&#252;nter Z&#246;chbauer

Reputation: 657801

The message indicated that package already exists.

If you are not the owner, you'll need to chose a different package name.

Upvotes: 2

Related Questions