I have a library that calls GCS (Google Cloud Storage). The library expects a JSON credentials file and fails if no file is provided.
For testing purposes is there a way to create a JSON credentials file that represents an anonymous user?
I have tried passing an empty JSON object, but that results in an error.
Note: the library in question is internal and as a workaround has been modified to instantiate a GCS client using JSON credentials or an anonymous client based on configuration. This solution is suboptimal since it introduces code that will only be used during testing.
For testing purposes is there a way to create a JSON credentials file that represents an anonymous user?
No.
The user (identity) is specified by an OAuth Token using the HTTP header Authorization Bearer TOKEN.
An anonymous request is one without the HTTP header Authorization.