Skip to content

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

@m-rhnm

Description

@m-rhnm
C:\Users\Microsoft\Documents\flutter\bin\cache\dart-sdk\bin>.\dart pub login --verbose
FINE: Pub 3.8.1
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%3A1088&code_challenge=V4ejho7OusMgx_Jflhkcx5pUXJNj4JTJcGz0wh5x2Sk&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 3.8.1
IO  : HTTP response 200 OK for POST https://accounts.google.com/o/oauth2/token
    | took 0:00:00.425537
    | cache-control: no-cache, no-store, max-age=0, must-revalidate
    | date: Sat, 09 Aug 2025 07:56:26 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
    | 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 3.8.1
IO  : HTTP response 200 OK for GET https://accounts.google.com/.well-known/openid-configuration
    | took 0:00:00.100255
    | last-modified: Wed, 14 Feb 2024 20:36:03 GMT
    | cache-control: public, max-age=3600
    | access-control-allow-origin: *
    | date: Sat, 09 Aug 2025 07:24:47 GMT
    | vary: Accept-Encoding
    | content-encoding: gzip
    | age: 1899
    | 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
    | accept-ranges: bytes
    | content-length: 460
    | x-content-type-options: nosniff
    | expires: Sat, 09 Aug 2025 08:24:47 GMT
IO  : HTTP GET https://openidconnect.googleapis.com/v1/userinfo
    | authorization: <censored>
    | user-agent: Dart pub 3.8.1
IO  : HTTP response 200 OK for GET https://openidconnect.googleapis.com/v1/userinfo
    | took 0:00:00.561188
    | cache-control: no-cache, no-store, max-age=0, must-revalidate
    | date: Sat, 09 Aug 2025 07:56:27 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
    | x-frame-options: SAMEORIGIN
    | x-content-type-options: nosniff
    | expires: Mon, 01 Jan 1990 00:00:00 GMT
FINE: Bad response from https://openidconnect.googleapis.com/v1/userinfo: {
    |   "sub": "116010460693135520954",
    |   "picture": "https://lh3.googleusercontent.com/a-/ALV-UjUaDOPlwwO2xBXqz0AB7ctO6ZXbMKwUeujB1tugXH5UG6EA40jz\u003ds96-c",
    |   "email": "[email protected]",
    |   "email_verified": true
    | }
FINE: Saving OAuth2 credentials.
IO  : Writing 1476 characters to text file C:\Users\Microsoft\AppData\Roaming\dart\pub-credentials.json.WARN: Could not retrieve your user-details.
    | You might have to run `dart pub logout` to delete your credentials and try again.
IO  : Writing 4563 characters to text file C:\Users\Microsoft\AppData\Local\Pub\Cache\log\pub_log.txt.
MSG : Logs written to C:\Users\Microsoft\AppData\Local\Pub\Cache\log\pub_log.txt.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions