10000 Using the refresh token parse util provided by google-auth (#118) · ClarkDing/firebase-admin-python@0b2b029 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0b2b029

Browse files
authored
Using the refresh token parse util provided by google-auth (firebase#118)
1 parent c05ee5d commit 0b2b029

File tree

3 files changed

+4
-14
lines changed

3 files changed

+4
-14
lines changed

firebase_admin/credentials.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,7 @@ def __init__(self, refresh_token):
175175
if json_data.get('type') != self._CREDENTIAL_TYPE:
176176
raise ValueError('Invalid refresh token configuration. JSON must contain a '
177177
'"type" field set to "{0}".'.format(self._CREDENTIAL_TYPE))
178-
try:
179-
client_id = json_data['client_id']
180-
client_secret = json_data['client_secret']
181-
refresh_token = json_data['refresh_token']
182-
except KeyError as error:
183-
raise ValueError('Failed to initialize a refresh token credential. '
184-
'Missing key: {0}'.format(error))
185-
self._g_credential = credentials.Credentials(
186-
token=None, refresh_token=refresh_token,
187-
token_uri='https://accounts.google.com/o/oauth2/token',
188-
client_id=client_id, client_secret=client_secret, scopes=_scopes)
178+
self._g_credential = credentials.Credentials.from_authorized_user_info(json_data, _scopes)
189179

190180
@property
191181
def client_id(self):

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pytest >= 3.0.6
33
pytest-cov >= 2.4.0
44
tox >= 2.6.0
55

6-
google-auth >= 1.1.0
6+
google-auth >= 1.3.0
77
google-cloud-firestore >= 0.27.0
88
google-cloud-storage >= 1.2.0
99
requests >= 2.13.0

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
long_description = ('The Firebase Admin Python SDK enables server-side (backend) Python developers '
3333
'to integrate Firebase into their services and applications.')
3434
install_requires = [
35-
'google-auth>=1.1.0',
35+
'google-auth>=1.3.0',
3636
'google-cloud-firestore>=0.27.0',
37-
'google-cloud-storage>=1.2.0',
37+
'google-cloud-storage>=1.2.0',
3838
'requests>=2.13.0',
3939
'six>=1.6.1'
4040
]

0 commit comments

Comments
 (0)
0