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
Oauth2 issue: TypeError: refresh_authorization() got an unexpected keyword argument 'installed' #143
Comments
Maybe somehow you are generating it in a different way? Mine looks like:
Did you automatically let it be generated? Just point to a non-existing file and it will try to fill it when it doesn't exist.... so...
|
Yes, I was using Google’s JSON file copied from the registered app in the developer console… like using Google Mail API.
The automatic generation did not work in multiple consoles hanging at the end during the input of Google’s response code.
But after a restart it finally worked out and is running fine now, thanks.
Best,
David
From: Pascal van Kooten [mailto:notifications@github.com]
Sent: Montag, 2. September 2019 13:37
To: kootenpv/yagmail <yagmail@noreply.github.com>
Cc: David Czarnecki <spyz@gmx.de>; Author <author@noreply.github.com>
Subject: Re: [kootenpv/yagmail] Oauth2 issue: TypeError: refresh_authorization() got an unexpected keyword argument 'installed' (#143)
Maybe somehow you are generating it in a different way?
Mine looks like:
{
"google_refresh_token": "XXXXXXX",
"google_client_secret": "XXX",
"google_client_id": "XXXX",
"email_address": "XXX"
}
Did you automatically let it be generated? Just point to a non-existing file and it will try to fill it when it doesn't exist.... so...
yag.SMTP(..., oauth2_file="/my/path")
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#143?email_source=notifications&email_token=AHMZHNIXOYVXEZJNK2CQDSTQHT3G3A5CNFSM4IS33FRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5VSIIQ#issuecomment-527115298> , or mute the thread <https://github.com/notifications/unsubscribe-auth/AHMZHNKSCLOOEZOUVTKQEV3QHT3G3ANCNFSM4IS33FRA> . <https://github.com/notifications/beacon/AHMZHNIERXNBI54E4QNNBZTQHT3G3A5CNFSM4IS33FRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5VSIIQ.gif>
|
Glad to hear it worked! |
same problem here. The google generated .json file does not work. If I point to a non-existing file |
I also ran into this problem because Google is not clear that the json file you download when you create the Oauth2 is not the same one you need your app to have access to in order to use yagmail. Here's what I did, hopefully this helps somebody:
Some further helpful links: |
I am having the same problem(s) with oauth2 authentication: my file was not in the format specified by DavCza commented [on Sep 2, 2019 (https://github.com//issues/143#issuecomment-527216566) above. When I followed the instructions below I get to step 8 where it is asking to click a link to authenticate, I am simultaneously asked "Enter the localhost URL you were redirected to: >?" to which I replied "http://localhost". I am then brought to google's authentication asking for my email and "Google hasn’t verified this app > continue". So close! But instead of continuing, I get an error page stating "This site can’t be reached / localhost refused to connect. Try: Checking the connection / Checking the proxy and the firewall / ERR_CONNECTION_REFUSED" Any ideas? I have tried many suggestions and combinations but feel I am going around in circles.
|
Env: Win 10, Python 3.7, yagmail 0.11.220:
Any idea?:
The first key in the stored client secret JSON file from Google is 'installed.
The oauth2 module seems to have a problem accepting it as a kw arg:
File "c:_dev\venv\a3-nlp\lib\site-packages\yagmail\oauth2.py", line 96, in get_oauth_string
access_token, expires_in = refresh_authorization(**oauth2_info)
TypeError: refresh_authorization() got an unexpected keyword argument 'installed'
oauth2.py:
def get_oauth_string(user, oauth2_info):
access_token, expires_in = refresh_authorization(**oauth2_info)
auth_string = generate_oauth2_string(user, access_token, as_base64=True)
return auth_string
client_secret_gmail.json:
{"installed":
{"client_id":"224588364290-8enok2fodado2rkrh26go11q3p11dbgi.apps.googleusercontent.com",
"project_id":"yagmail-oauth2",
"auth_uri":"https://accounts.google.com/o/oauth2/auth",
"token_uri":"https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs",
"client_secret":"-----------",
"redirect_uris":["urn:ietf:wg:oauth:2.0:oob",
"http://localhost"]}}
The text was updated successfully, but these errors were encountered: