# Curl command to create mediacache with google storage source (credentials issue)

**URL:** https://community.wowza.com/t/curl-command-to-create-mediacache-with-google-storage-source-credentials-issue/55419
**Category:** Wowza Developer Dojo
**Created:** [June 18, 2020, 7:51am UTC](https://community.wowza.com/t/curl-command-to-create-mediacache-with-google-storage-source-credentials-issue/55419 "2020-06-18T07:51:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Justin\_Cooke](https://avatars.discourse-cdn.com/v4/letter/j/8dc957/32.png) [@Justin\_Cooke](https://community.wowza.com/u/Justin_Cooke)
#### Post date: [June 18, 2020, 7:51am UTC](https://community.wowza.com/t/curl-command-to-create-mediacache-with-google-storage-source-credentials-issue/55419/1 "2020-06-18T07:51:16Z")

</div>

Hi I am trying to setup a mediacache with google cloud storage as a source using the rest API however I I am getting a jackson parse error due to the credentials not being what is expected. Can you please correct this curl command so that I can add the google credentials or advise how to encrypt.

```auto
  curl -X POST \

-H 'Accept:application/json; charset=utf-8' \

-H 'Content-type:application/json; charset=utf-8' \

http://127.0.0.1:8087/v3/servers/_defaultServer_/mediacache/sources/media-store-prod-input-1 \

-d '

{

    "type": "GoogleCloudStorage",

    "basePath": "https://storage.googleapis.com/",

    "prefix": "http/",

    "minTimeToLive": 14400000,

    "maxTimeToLive": 28800000,

    "isAmazonS3": false,

    "s3BucketNameInDomain": false,

    "awsAccessKeyId": "",

    "awsSecretAccessKey": "",

    "isPassThru": false,

    "baseClass": "com.wowza.wms.mediacache.impl.MediaCacheItemHTTPImpl",

    "httpReaderFactoryClass": "com.wowza.wms.mediacache.impl.MediaCacheItemHTTPGoogleStorageFactory",

    "azureAccountName": "",

    "azureContainerName": "",

    "azureAccountKey": "",

    "googleServiceID": "some-cloud-storage-prod@myproject.iam.gserviceaccount.com",

    "googleServiceKey": {

        "type": "service_account",

        "project_id": "some-project",

        "private_key_id": "XXXXXXXXXXX",

        "private_key": "-----BEGIN PRIVATE KEY-----\XXXXXXXXXXXXXXX\XXXXXXXXX+XXXXXXXXXX==\n-----END PRIVATE KEY-----\n",

        "client_email": "some-cloud-storage-prod@myproject.iam.gserviceaccount.com",

        "client_id": "115155345353555353",

        "auth_uri": "https://accounts.google.xcom/o/oauth2/auth",

        "token_uri": "https://oauth2.googleapis.com/token",

        "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",

        "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/someones-cloud-storage-prod%40myproject.iam.gserviceaccount.com"

      },

    "googleServicePrivateKeyFile": "",

    "googleServicePrivateKeyPassword": "",

    "googleEncMethod": "JSON"

  }' | jq

```

I get the following response:

```auto
  "message": "com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token\n at [Source: (ByteArrayInputStream); line: 19, column: 25] (through reference chain: com.wowza.wms.rest.server.mediacache.MediaCacheSourceConfig3[\"googleServiceKey\"])",

```

based the command by querying an instance I setup earlier and manually configured, but the key is just an encrypted string in that instance.

What is the correct way of doing this? I will inject the service account credentials in via an environment variable / secret in real life.

---

<div class="post-metadata">

### Author: ![video\_streaming](https://avatars.discourse-cdn.com/v4/letter/v/22d042/32.png) [@video\_streaming](https://community.wowza.com/u/video_streaming)
#### Post date: [June 19, 2020, 7:45pm UTC](https://community.wowza.com/t/curl-command-to-create-mediacache-with-google-storage-source-credentials-issue/55419/2 "2020-06-19T19:45:36Z")

</div>

Checking with an REST API engineer for you…

---

<div class="post-metadata">

### Author: ![video\_streaming](https://avatars.discourse-cdn.com/v4/letter/v/22d042/32.png) [@video\_streaming](https://community.wowza.com/u/video_streaming)
#### Post date: [June 19, 2020, 10:58pm UTC](https://community.wowza.com/t/curl-command-to-create-mediacache-with-google-storage-source-credentials-issue/55419/3 "2020-06-19T22:58:19Z")

</div>

You essentially have to get a hash of that code that you included @Justin Cooke. If you are using the JSON authenticationType, you will need to change the \n characters in the JSON file you downloaded to a newline, and then Base64 to UTF-8 charset the private\_key value from the JSON file. You can use any online tool to do this (such as [base64encode.org](http://base64encode.org/)). Use the output in the secretAccessKey parameter.

Each GCE account would have its own key, that they need to convert to a hash.

Those keys are found in a JSON file that you got from Google site.

It sounds like you have the json file already, You just need direction on how to obtain the hash.

Please submit a ticket if you have any issues. Thanks.
