google-cloud-rust icon indicating copy to clipboard operation
google-cloud-rust copied to clipboard

json error: expected value at line 1 column 1

Open ag039st opened this issue 1 year ago • 3 comments

MAC os m3 ,

I used auth application-default login, and Im using the same json ,

but this is failling with json error: expected value at line 1 column 1 no clear of which expected value failed

let config = ClientConfig::default().with_auth().await; match config { Ok(con) => { let client = Client::new(con); info!("successfully connected ") } Err(error) => { error!("something failed {}",error) } }

ag039st avatar Feb 14 '24 05:02 ag039st

This doesn't work for me either. I have vanilla JSON, downloaded from GCP, and configured the path with GOOGLE_APPLICATION_CREDENTIALS_JSON env. This error hit me in the face...

jendakol avatar Sep 23 '24 15:09 jendakol

Let me add that this works just fine:

    let credentials: CredentialsFile = serde_json::from_slice(&fs::read(std::env::var(
        "GOOGLE_APPLICATION_CREDENTIALS_JSON",
    )?)?)?;

    let config = ClientConfig::default()
        .with_credentials(credentials)
        .await?;

jendakol avatar Sep 23 '24 17:09 jendakol

Ehm, I am ashamed but my problem was that I used GOOGLE_APPLICATION_CREDENTIALS_JSON and put there path to the JSON file. Using GOOGLE_APPLICATION_CREDENTIALS works just fine.

jendakol avatar Sep 23 '24 17:09 jendakol