Skip to content

chore(auth): Update Auth API to v2 #691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 6, 2023
Merged
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
4 changes: 2 additions & 2 deletions firebase_admin/_auth_client.py
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ def __init__(self, app, tenant_id=None):
if emulator_host:
base_url = 'http://{0}/identitytoolkit.googleapis.com'.format(emulator_host)
endpoint_urls['v1'] = base_url + '/v1'
endpoint_urls['v2beta1'] = base_url + '/v2beta1'
endpoint_urls['v2'] = base_url + '/v2'
credential = _utils.EmulatorAdminCredentials()
self.emulated = True
else:
@@ -67,7 +67,7 @@ def __init__(self, app, tenant_id=None):
self._user_manager = _user_mgt.UserManager(
http_client, app.project_id, tenant_id, url_override=endpoint_urls.get('v1'))
self._provider_manager = _auth_providers.ProviderConfigClient(
http_client, app.project_id, tenant_id, url_override=endpoint_urls.get('v2beta1'))
http_client, app.project_id, tenant_id, url_override=endpoint_urls.get('v2'))

@property
def tenant_id(self):
2 changes: 1 addition & 1 deletion firebase_admin/_auth_providers.py
Original file line number Diff line number Diff line change
@@ -176,7 +176,7 @@ def items(self):
class ProviderConfigClient:
"""Client for managing Auth provider configurations."""

PROVIDER_CONFIG_URL = 'https://identitytoolkit.googleapis.com/v2beta1'
PROVIDER_CONFIG_URL = 'https://identitytoolkit.googleapis.com/v2'

def __init__(self, http_client, project_id, tenant_id=None, url_override=None):
self.http_client = http_client
2 changes: 1 addition & 1 deletion firebase_admin/tenant_mgt.py
Original file line number Diff line number Diff line change
@@ -232,7 +232,7 @@ def enable_email_link_sign_in(self):
class _TenantManagementService:
"""Firebase tenant management service."""

TENANT_MGT_URL = 'https://identitytoolkit.googleapis.com/v2beta1'
TENANT_MGT_URL = 'https://identitytoolkit.googleapis.com/v2'

def __init__(self, app):
credential = app.credential.get_credential()
4 changes: 2 additions & 2 deletions tests/test_auth_providers.py
Original file line number Diff line number Diff line change
@@ -23,10 +23,10 @@
from firebase_admin import exceptions
from tests import testutils

ID_TOOLKIT_URL = 'https://identitytoolkit.googleapis.com/v2beta1'
ID_TOOLKIT_URL = 'https://identitytoolkit.googleapis.com/v2'
EMULATOR_HOST_ENV_VAR = 'FIREBASE_AUTH_EMULATOR_HOST'
AUTH_EMULATOR_HOST = 'localhost:9099'
EMULATED_ID_TOOLKIT_URL = 'http://{}/identitytoolkit.googleapis.com/v2beta1'.format(
EMULATED_ID_TOOLKIT_URL = 'http://{}/identitytoolkit.googleapis.com/v2'.format(
AUTH_EMULATOR_HOST)
URL_PROJECT_SUFFIX = '/projects/mock-project-id'
USER_MGT_URLS = {
4 changes: 2 additions & 2 deletions tests/test_tenant_mgt.py
Original file line number Diff line number Diff line change
@@ -108,8 +108,8 @@
INVALID_BOOLEANS = ['', 1, 0, list(), tuple(), dict()]

USER_MGT_URL_PREFIX = 'https://identitytoolkit.googleapis.com/v1/projects/mock-project-id'
PROVIDER_MGT_URL_PREFIX = 'https://identitytoolkit.googleapis.com/v2beta1/projects/mock-project-id'
TENANT_MGT_URL_PREFIX = 'https://identitytoolkit.googleapis.com/v2beta1/projects/mock-project-id'
PROVIDER_MGT_URL_PREFIX = 'https://identitytoolkit.googleapis.com/v2/projects/mock-project-id'
TENANT_MGT_URL_PREFIX = 'https://identitytoolkit.googleapis.com/v2/projects/mock-project-id'


@pytest.fixture(scope='module')