Flutter软件包pub-UnauthorizedAccess:未经授权的用户:...不允许将版本上传到软件包

时间:2019-01-25 12:36:02

标签: oauth-2.0 dart flutter dart-pub

我正在尝试发布一个新的flutter插件。我按照所有步骤进行了publish my package,我的代码已上传到github:flutter_image_share,一切准备就绪,可以发布了。

当我运行flutter packages pub publish时,会收到以下响应:

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".

我转到链接,用我的Google帐户进行身份验证,最后得到以下结果:

Waiting for your authorization...
Authorization received, processing...
Successfully authorized.
Uploading...
UnauthorizedAccess: Unauthorized user: nadiagnieto@gmail.com is not allowed to upload versions to package flutter_share_image..

此后,我运行以下命令:rm ~/.pub-cache/credentials.json删除凭据。json和pub uploader add nadiagnieto@gmail.com --verbosity=all授予对此电子邮件的权限,但得到以下响应:

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

我不知道我做错了什么。有人知道如何上传我的包裹吗?我想发布两个新程序包,但我不能这样做。

1 个答案:

答案 0 :(得分:1)

该消息表明软件包已存在。

如果您不是所有者,则需要选择其他软件包名称。