Repository navigation
Conversation
| exp = datetime.timedelta(minutes=60) | ||
| return jwt.generate_jwt(payload, private_key, "RS256", exp) | ||
| claims.update(additional_claims) | ||
| credentials = jwt.Credentials.from_signing_credentials( |
There was a problem hiding this comment.
Instead of creating a credentials class you don't need, you can actually use self.credentials.signer and jwt.encode directly.
There was a problem hiding this comment.
I originally had it set up the way you described. Then, I looked at the source of jwt.Credentials.refresh and realized it did the exact same thing with a more concise API. I also thought the current approach supported better separation of concerns—pyrebase doesn't have to worry about constructing a valid JWT payload in this case.
I admit credentials.refresh(None) is a little weird, but that seemed a small price to pay to avoid duplicating the refresh method.
What do you think?
| python-jwt==2.0.1 | ||
| pycrypto==2.6.1 No newline at end of file | ||
| requests>=2.11.0 | ||
| gcloud>=0.17.0 |
There was a problem hiding this comment.
I would strongly recommend not depending on this package at all. It's not been updated in quite some time. I'd switch to depend on the individual google-cloud-{thing} packages.
|
@thisbejim Thoughts on getting this merged? |
|
Hi @thisbejim Thank for your support |
|
hi @heston . I have just tried with my application, but I think it seem to do not fix the issue: |
|
I'm experiencing the intermittent 401 problem as well. Please merge the google-auth branch with |
|
@quoctc It looks like the oauth2 request is returning a 200 ( |
|
hi @heston , Sorry I'm busy these day. So I was not uppdated my problem at here. My application was worked fine. |
|
It would be better if we can pass a |
| from urllib import urlencode, quote | ||
|
|
||
|
|
||
| def initialize_app(config): |
There was a problem hiding this comment.
for example:
def initialize_app(config, session=None):
if session is not None:
self.requests = session
else:
...In this case we can use our own session.
There was a problem hiding this comment.
@lepture That's a good idea. However, I think it's a bit outside the scope of this PR. It would change the external API, and I was trying not to do that as part of this change. I'm intending for google-auth to be a drop-in replacement for oauth2client.
|
im not sure if it is only on my pc, but after installing this PR i got an error :
solved the issue |
|
@heston how can I install this version ? |
|
@abdelwahebmoalla I install it in "editable" mode directly from GitHub: This has some drawbacks (mainly, it's slow, since it has to clone the repo), but generally works fine. |
|
For everyone using this version there has been an update to firebase and other changes should be done |
|
The |
This replaces the now deprecated oauth2client with google-auth. This should fix issues with token expiration.
n.b. I also sorted the imports at the top of
pyrebase.pyto be compliant with PEP 8.