AChesser011384 / got-your-back

Automatically exported from code.google.com/p/got-your-back
0 stars 0 forks source link

OAuth 2.0 not working #67

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. python gyb.py --email yyyyyy@yourdomain.com --service-account 
xxxxxxxxxx@developer.gserviceaccount.com --action estimate
2.
3.

What is the expected output? What do you see instead?

Traceback (most recent call last):
  File "gyb.py", line 1011, in <module>
    main(sys.argv[1:])
  File "gyb.py", line 492, in main
    imapconn = gimaplib.ImapConnect(generateXOAuthString(options.email, options.service_account), options.debug)
  File "gyb.py", line 195, in generateXOAuthString
    service = apiclient.discovery.build('oauth2', 'v2', http=http)
  File "/Users/rbeyer/gyb/oauth2client/util.py", line 128, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/Users/rbeyer/gyb/apiclient/discovery.py", line 192, in build
    resp, content = http.request(requested_url)
  File "/Users/rbeyer/gyb/oauth2client/util.py", line 128, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/Users/rbeyer/gyb/oauth2client/client.py", line 475, in new_request
    self._refresh(request_orig)
  File "/Users/rbeyer/gyb/oauth2client/client.py", line 653, in _refresh
    self._do_refresh_request(http_request)
  File "/Users/rbeyer/gyb/oauth2client/client.py", line 677, in _do_refresh_request
    body = self._generate_refresh_request_body()
  File "/Users/rbeyer/gyb/oauth2client/client.py", line 861, in _generate_refresh_request_body
    assertion = self._generate_assertion()
  File "/Users/rbeyer/gyb/oauth2client/client.py", line 977, in _generate_assertion
    private_key, self.private_key_password), payload)
  File "/Users/rbeyer/gyb/oauth2client/crypt.py", line 294, in make_signed_jwt
    signature = signer.sign(signing_input)
  File "/Users/rbeyer/gyb/oauth2client/crypt.py", line 112, in sign
    return crypto.sign(self._key, message, 'sha256')
AttributeError: 'module' object has no attribute 'sign'
rabmacmini:gyb rbeyer$ sudo python ./gyb.py --email kcarnes@hlg.com 
--service-account 378821280184@developer.gserviceaccount.com --action estimate
Traceback (most recent call last):
  File "./gyb.py", line 1011, in <module>
    main(sys.argv[1:])
  File "./gyb.py", line 492, in main
    imapconn = gimaplib.ImapConnect(generateXOAuthString(options.email, options.service_account), options.debug)
  File "./gyb.py", line 195, in generateXOAuthString
    service = apiclient.discovery.build('oauth2', 'v2', http=http)
  File "/Users/rbeyer/gyb/oauth2client/util.py", line 128, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/Users/rbeyer/gyb/apiclient/discovery.py", line 192, in build
    resp, content = http.request(requested_url)
  File "/Users/rbeyer/gyb/oauth2client/util.py", line 128, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/Users/rbeyer/gyb/oauth2client/client.py", line 475, in new_request
    self._refresh(request_orig)
  File "/Users/rbeyer/gyb/oauth2client/client.py", line 653, in _refresh
    self._do_refresh_request(http_request)
  File "/Users/rbeyer/gyb/oauth2client/client.py", line 677, in _do_refresh_request
    body = self._generate_refresh_request_body()
  File "/Users/rbeyer/gyb/oauth2client/client.py", line 861, in _generate_refresh_request_body
    assertion = self._generate_assertion()
  File "/Users/rbeyer/gyb/oauth2client/client.py", line 977, in _generate_assertion
    private_key, self.private_key_password), payload)
  File "/Users/rbeyer/gyb/oauth2client/crypt.py", line 294, in make_signed_jwt
    signature = signer.sign(signing_input)
  File "/Users/rbeyer/gyb/oauth2client/crypt.py", line 112, in sign
    return crypto.sign(self._key, message, 'sha256')
AttributeError: 'module' object has no attribute 'sign'

What version of the product are you using? On what operating system?
gyb 0.20 on MAC OS X 10.6.8

Please provide any additional information below.

Original issue reported on code.google.com by mail.ad...@hlg.com on 27 Jun 2013 at 6:04

GoogleCodeExporter commented 9 years ago
oops... Too much information ;-) ...missed my double copy of the traceback!  
The Service Account that was disclosed has been deleted.

Original comment by mail.ad...@hlg.com on 27 Jun 2013 at 6:11

GoogleCodeExporter commented 9 years ago
Try upgrading to Python 2.7.5 and see if that helps:

http://python.org/download/

Original comment by jay0lee@gmail.com on 27 Jun 2013 at 6:21

GoogleCodeExporter commented 9 years ago
Upgraded to Python 2.7.5 (verified the by the banner);  Set up a new service 
account and authorized it in the domain admin panel.

New error message:
Traceback (most recent call last):
  File "gyb.py", line 1011, in <module>
    main(sys.argv[1:])
  File "gyb.py", line 492, in main
    imapconn = gimaplib.ImapConnect(generateXOAuthString(options.email, options.service_account), options.debug)
  File "gyb.py", line 187, in generateXOAuthString
    credentials = oauth2client.client.SignedJwtAssertionCredentials(service_account_name=service_account, private_key=key, scope=scope, user_agent=getGYBVersion(' / '), prn=email)
AttributeError: 'module' object has no attribute 'SignedJwtAssertionCredentials'

Original comment by mail.ad...@hlg.com on 27 Jun 2013 at 10:06

GoogleCodeExporter commented 9 years ago
The problem is caused by the following code in oauth2client/client.py

886 if HAS_CRYPTO:
887  # PyOpenSSL and PyCrypto are not prerequisites for oauth2client, so if it 
is
888  # missing then don't create the SignedJwtAssertionCredentials or the
889  # verify_id_token() method.

Basically you only need to install PyOpenSSL and PyCrypto (using easy_install) 
to fix the problem. It would be nice to get a more useful error message though.

Original comment by tiaan.sc...@gmail.com on 21 Aug 2013 at 5:03

GoogleCodeExporter commented 9 years ago
In case someone faces the same issue as me: This guide helped me to install 
Python 2.7.5 along the repository one:
http://www.bango29.com/go/blog/2013/python-2-7-5-on-centos-6-x

In case you face errors at this
$ python2.7 setup.py install
step, make sure to build python with the needed modules (the error tells you 
which, I forgot some ssl I think). After that, when easy_install works, just 
install pycrypto and pyopenssl and all works fine

Original comment by nils.reh...@mutel.de on 22 Aug 2013 at 10:40

GoogleCodeExporter commented 9 years ago
I didn't use python, as I'm not an expert. But whenever I got to the permission 
page, the "accept" button did not work. So I followed instructions to add 
"nobrowser.txt" to the c:gyb directory & tried again. Same results. No response 
to "accept" button, thus no verification code to enter at CMD prompt. I'm not 
in a position to even begin to understand the info added above. But this item 
(#67) seemed to best describe my problem when I went through the list.  I 
really need to backup my messages before I try uninstalling the gmail program 
which is no longer working. No downloaded messages for 5 days, and no response 
when I try to open any existing messages. Please help. Alternate email:  
jonandsid@yahoo.com  thanks

Original comment by sid.reti...@gmail.com on 15 Apr 2014 at 4:58