Search code examples
google-apps-scriptgoogle-cloud-platformgoogle-apigoogle-oauthgoogle-workspace

OAuth consent screen - ability to remove application logo: old solution is no longer working


Question: how to remove an application logo.

Solution: previous solution from this answer, https://stackoverflow.com/a/57168008/1992004, is no longer working.

Google changed the format of "iconUrl" to "icon", and uses now the Base64-encoded data stream, like "icon":"iVBORw0KGgoAAAAN..., instead of the image URL, previously written as "iconUrl":"https://...".

I've tried "icon":"" and many Base64-encoded values like "icon":"IA", "icon":"Lw", and some of other - no success. I get console messages like

for "icon":""

{
  "error": {
    "code": 400,
    "message": "The request failed because one of the field of the resource is invalid.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.PreconditionFailure",
        "violations": [
          {
            "type": "client_auth_config",
            "subject": "?error_code=9&error_field_name=UpdateIconRequest.icon&error_field_value=%3CByteString@3eeee81e+size%3D0+contents%3D%22%22%3E"
          }
        ]
      }
    ]
  }
}

or

{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.identity.clientauthconfig.v1.ClientAuthConfigError",
        "code": "ICON_STORAGE_FAILURE"
      },
      {
        "@type": "type.googleapis.com/google.identity.clientauthconfig.v1.IconStorageError",
        "reason": "INVALID_IMAGE"
      }
    ]
  }
}

or

{
  "error": {
    "code": 400,
    "message": "Invalid value at 'icon' (TYPE_BYTES), Base64 decoding failed for \" \"",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "field": "icon",
            "description": "Invalid value at 'icon' (TYPE_BYTES), Base64 decoding failed for \" \""
          }
        ]
      }
    ]
  }
}

Does somebody know, what should be inserted here to remove the logo image from the app?


Solution

  • Answer:

    Unfortunately, there is no way for this to be done.

    More Information:

    Once an OAuth Application Logo has been uploaded there isn't a supported way of removing it - in the question that you linked the way that this was done is a bit hacky, inspecting the network requests and building a new request from the previous JSON object sent via the UI really shows this.

    As the icon URL has changed to need a Base-64 encoded value this has been deprecated. Whether this was intentional by Google or not is hard to say, but now an empty value will always return INVALID_ARGUMENT. Any data in the value for icon will also just replace the image data and so this isn't a viable workaround, as as far as the validation process goes, image data exists and so will need to be verified.

    If it's not too much of a arduous process, the only workaround here is to create a new GCP project with a new OAuth consent screen without uploading an image. Of course, you will need to reactivate all the relevant APIs and link the relevant scripts and projects to the new set-up.

    Feature Request:

    You can however let Google know that this is a feature that is important and that you would like to request they implement it. Google's Issue Tracker is a place for developers to report issues and make feature requests for their development services. I would suggest using the feature request template for G Suite Add-ons as this is a component for which GCP Projects could be used.

    Update: The feature request for this is viewable here, to increase visibility on this, hit the ☆ at the top of the page.

    Relevant Questions: