Skip to content

Implementing App Default and Refresh Token Credential Types #6

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
Mar 28, 2017

Conversation

hiranya911
Copy link
Contributor

No description provided.

Hiranya Jayathilaka added 2 commits March 27, 2017 19:06
Copy link

@jwngr jwngr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really good stuff! Handful of nits but otherwise LGTM. I assume you will make the Application Default Credential be initialized when no credential is provided to firebase.App in a follow-up PR?



class ApplicationDefault(Base):
"""A Google application default credential."""
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: capitalize "Application" and "Default" (multiple places in this file).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

"""A credential initialized from an existing refresh token."""

def __init__(self, file_path):
"""Initialized a refresh token credential from the specified JSON file.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Initialized/Initializes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

credentials._http = testutils.HttpMock(200, json.dumps(mock_response))
access_token = credential.get_access_token()
assert access_token.access_token == 'mock_access_token'
assert access_token.expires_in <= 1234
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this <= instead of ==? If it's non-obvious, please leave a comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because GoogleCredentials class recalculates the expires_in property before returning. Added a comment to mention that.

@jwngr jwngr assigned hiranya911 and unassigned jwngr Mar 28, 2017
@hiranya911
Copy link
Contributor Author

Made the suggested changes.

@hiranya911 hiranya911 assigned jwngr and unassigned hiranya911 Mar 28, 2017
Copy link

@jwngr jwngr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jwngr jwngr assigned hiranya911 and unassigned jwngr Mar 28, 2017
@hiranya911 hiranya911 merged commit 9b679d0 into master Mar 28, 2017
@hiranya911 hiranya911 deleted the hkj-other-credential-types branch March 28, 2017 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants