Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions firebase_admin/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import threading
from urllib import parse

import google.auth
from google.auth import credentials
import requests

import firebase_admin
Expand Down Expand Up @@ -802,7 +802,7 @@ def get_client(self, db_url=None):
credential = self._credential.get_credential()
else:
# Emulator base_url. Use fake credentials and specify ?ns=foo in query params.
credential = _EmulatorAdminCredentials()
credential = credentials.AnonymousCredentials()
params = {'ns': namespace}
if self._auth_override:
params['auth_variable_override'] = self._auth_override
Expand Down Expand Up @@ -978,12 +978,3 @@ def _extract_error_message(cls, response):
message = 'Unexpected response from database: {0}'.format(response.content.decode())

return message


class _EmulatorAdminCredentials(google.auth.credentials.Credentials):
def __init__(self):
google.auth.credentials.Credentials.__init__(self)
self.token = 'owner'

def refresh(self, request):
pass
4 changes: 2 additions & 2 deletions tests/test_token_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def test_sign_with_iam(self):
testutils.MockCredential(), name='iam-signer-app', options=options)
try:
signature = base64.b64encode(b'test').decode()
iam_resp = '{{"signature": "{0}"}}'.format(signature)
iam_resp = '{{"signedBlob": "{0}"}}'.format(signature)
_overwrite_iam_request(app, testutils.MockRequest(200, iam_resp))
custom_token = auth.create_custom_token(MOCK_UID, app=app).decode()
assert custom_token.endswith('.' + signature.rstrip('='))
Expand Down Expand Up @@ -259,7 +259,7 @@ def test_sign_with_discovered_service_account(self):
# Now invoke the IAM signer.
signature = base64.b64encode(b'test').decode()
request.response = testutils.MockResponse(
200, '{{"signature": "{0}"}}'.format(signature))
200, '{{"signedBlob": "{0}"}}'.format(signature))
custom_token = auth.create_custom_token(MOCK_UID, app=app).decode()
assert custom_token.endswith('.' + signature.rstrip('='))
self._verify_signer(custom_token, 'discovered-service-account')
Expand Down