Skip to content
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

google_api_get() function does not refresh headers and does same request twice with 401 error. #84

Open
xelblch opened this issue Feb 29, 2016 · 3 comments

Comments

@xelblch
Copy link

xelblch commented Feb 29, 2016

Hi there,

I'm trying to use django-mailbox library on one of my projects together with python-social-auth. The problem I found related to google_api_get() function here:
https://github.com/coddingtonbear/django-mailbox/blob/master/django_mailbox/google_utils.py#L53

Your first request on the line 57 in case of expired token will return 401 status code. So after this, you trying to refresh access token and store it in the database by calling refresh_authorization() function on line 61.

But after token refreshed and stored back to database you doing the same GET request on line 62. You still using old headers with old access token. This request also return 401 status code and there's None returned from this function.

Looks like you missed to update headers before doing this second GET request?

@coddingtonbear
Copy link
Owner

Hey there @xelblch, could you post a pull request fixing that? I'm not directly aware of how the gmail interactions work given that they were contributed by a patch, so I'll trust you if you think there's an oversight.

Cheers!

@afedosenko
Copy link

+1

@coddingtonbear
Copy link
Owner

@afedosenko -- if you, too, are interested in such a fix, could you contribute a patch adding this feature? I don't foresee having the time in the near future.

@pfouque pfouque added the bug label Dec 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants