Skip to content

Avoid Authentication When Connecting to Storage Emulator #324

@stefanadelbert

Description

@stefanadelbert

Problem
When connecting to a 3rd party storage emulator, like gcloud-storage-emulator, authentication is required. This requires injecting credentials into containers and adding conditional logic in code to authenticate when running against emulators.

import os
from firebase_admin import initialize_app, storage

os.environ['STORAGE_EMULATOR_HOST'] = 'http://localhost:9090'
assert 'GOOGLE_APPLICATION_CREDENTIALS' not in os.environ

initialize_app()
storage.bucket() # google.auth.exceptions.DefaultCredentialsError

Solution
When STORAGE_EMULATOR_HOST is set, use an insecure connection, as is done for firestore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: storageIssues related to the googleapis/python-storage API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions