Skip to content

dart pub login fails to write dart/pub-credentials.json after successful authentication #3424

Description

@GroovinChip
Pub version: 2.17.0
Created: 2022-05-13T11:22:56.449792
FLUTTER_ROOT: /Users/groovinchip/dev/flutter
PUB_HOSTED_URL: <not set>
PUB_CACHE: "<not set>"
Command: dart pub login
Platform: macos

---- Log transcript ----
FINE: Pub 2.17.0
FINE: Loading OAuth2 credentials.
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%3A58147&code_challenge=kfQIydIn0UcWwmCZS9EwNnNXGBTbUNUZXGYeUZPd29k&code_challenge_method=S256&scope=openid+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.17.0
IO  : HTTP response 200 OK for POST https://accounts.google.com/o/oauth2/token
    | took 0:00:00.229868
    | cache-control: no-cache, no-store, max-age=0, must-revalidate
    | date: Fri, 13 May 2022 15:22:56 GMT
    | transfer-encoding: chunked
    | content-encoding: gzip
    | vary: Origin,X-Origin,Referer
    | content-type: application/json; charset=utf-8
    | pragma: no-cache
    | x-xss-protection: 0
    | server: scaffolding on HTTPServer2
    | alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
    | x-frame-options: SAMEORIGIN
    | x-content-type-options: nosniff
    | expires: Mon, 01 Jan 1990 00:00:00 GMT
MSG : Successfully authorized.
IO  : HTTP GET https://accounts.google.com/.well-known/openid-configuration
    | user-agent: Dart pub 2.17.0
IO  : HTTP response 200 OK for GET https://accounts.google.com/.well-known/openid-configuration
    | took 0:00:00.019982
    | last-modified: Thu, 16 Jan 2020 21:53:16 GMT
    | cache-control: public, max-age=3600
    | access-control-allow-origin: *
    | date: Fri, 13 May 2022 14:59:14 GMT
    | content-encoding: gzip
    | vary: Accept-Encoding
    | age: 1422
    | report-to: {"group":"federated-signon-mpm-access","max_age":2592000,"endpoints":[{"url":"https://csp.withgoogle.com/csp/report-to/federated-signon-mpm-access"}]}
    | content-type: application/json
    | cross-origin-opener-policy: same-origin; report-to="federated-signon-mpm-access"
    | x-xss-protection: 0
    | server: sffe
    | content-security-policy-report-only: require-trusted-types-for 'script'; report-uri https://csp.withgoogle.com/csp/federated-signon-mpm-access
    | alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
    | accept-ranges: bytes
    | content-length: 464
    | x-content-type-options: nosniff
    | expires: Fri, 13 May 2022 15:59:14 GMT
IO  : HTTP GET https://openidconnect.googleapis.com/v1/userinfo
    | authorization: <censored>
    | user-agent: Dart pub 2.17.0
IO  : HTTP response 200 OK for GET https://openidconnect.googleapis.com/v1/userinfo
    | took 0:00:00.145133
    | cache-control: no-cache, no-store, max-age=0, must-revalidate
    | date: Fri, 13 May 2022 15:22:56 GMT
    | transfer-encoding: chunked
    | content-encoding: gzip
    | vary: Origin,X-Origin,Referer
    | content-type: application/json; charset=utf-8
    | pragma: no-cache
    | x-xss-protection: 0
    | server: ESF
    | alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
    | x-frame-options: SAMEORIGIN
    | x-content-type-options: nosniff
    | expires: Mon, 01 Jan 1990 00:00:00 GMT
FINE: Saving OAuth2 credentials.
IO  : Writing 1377 characters to text file /Users/groovinchip/Library/Application Support/dart/pub-credentials.json.
ERR : type 'Null' is not a subtype of type 'String'
FINE: Exception type: _TypeError
ERR : package:pub/src/command/login.dart 50:34  LoginCommand._retrieveUserInfo.<fn>
    | ===== asynchronous gap ===========================
    | package:pub/src/command/login.dart 42:12  LoginCommand._retrieveUserInfo
    | ===== asynchronous gap ===========================
    | package:pub/src/command/login.dart 28:24  LoginCommand.runProtected
ERR : This is an unexpected error. The full log and other details are collected in:
    | 
    |     /Users/groovinchip/.pub-cache/log/pub_log.txt
    | 
    | Consider creating an issue on https://github.com/dart-lang/pub/issues/new
    | and attaching the relevant parts of that log file.
---- End log transcript ----

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions