ESPRI-Mod / synda

ESGF Downloader (this is a deprecated repository, the tool has now moved to https://github.com/ESGF/esgf-download)
https://espri-mod.github.io/synda/
21 stars 11 forks source link

Error renew globus token #140

Closed YanchunHe closed 4 years ago

YanchunHe commented 4 years ago

Hi,

I set up synda with some tweaks, and then end up here for a globus token.

To reproduce this issue:

$ synda get -d ./ CMIP6.CMIP.NCC.NorESM2-MM.historical.r1i1p1f1.Omon.tos.gn.v20191108
5 file(s) will be downloaded for a total size of 161.5 MB.
Globus tokens not found (use 'renew' command to retrieve new tokens).

Then I renew the token:

$ synda token -p globus renew
Native App Authorization URL:
https://auth.globus.org/v2/oauth2/authorize?code_challenge=BrmiBhFVVuHVNyGDj6hn5N8M1-EKJNnNgptobIsbTqI&state=_default&redirect_uri=https%3A%2F%2Fauth.globus.org%2Fv2%2Fweb%2Fauth-code&response_type=code&client_id=83ec00c1-e67a-4356-9f1f-f7e31177e31a&scope=openid+email+profile+urn%3Aglobus%3Aauth%3Ascope%3Atransfer.api.globus.org%3Aall&code_challenge_method=S256&access_type=offline
Enter the auth code: EifMVryVwfexuvHun9dFX2brlVtj71

I paste the above address to the browser and get an auth code, and paste the auth code (EifMVryVwfexuvHun9dFX2brlVtj71) to the stdin. And then got an error:

Traceback (most recent call last):
  File "/projects/NS9252K/conda/synda/bin/synda", line 11, in <module>
    sys.exit(run())
  File "/projects/NS9252K/conda/synda/lib/python2.7/site-packages/synda-3.10-py2.7.egg-info/scripts/synda.py", line 178, in run
    status=sdtiaction.actions[args.subcommand](args)
  File "/projects/NS9252K/conda/synda/lib/python2.7/site-packages/synda-3.10-py2.7.egg-info/scripts/sdtiaction.py", line 685, in token
    sdtoken.renew_tokens()
  File "/projects/NS9252K/conda/synda/lib/python2.7/site-packages/synda-3.10-py2.7.egg-info/scripts/sdtoken.py", line 82, in renew_tokens
    requested_scopes=scopes)
  File "/projects/NS9252K/conda/synda/lib/python2.7/site-packages/synda-3.10-py2.7.egg-info/scripts/sdtoken.py", line 73, in do_native_app_authentication
    token_response = client.oauth2_exchange_code_for_tokens(auth_code)
  File "/projects/NS9252K/conda/synda/lib/python2.7/site-packages/globus_sdk/auth/client_types/base.py", line 229, in oauth2_exchange_code_for_tokens
    return self.current_oauth2_flow_manager.exchange_code_for_tokens(auth_code)
  File "/projects/NS9252K/conda/synda/lib/python2.7/site-packages/globus_sdk/auth/oauth2_native_app.py", line 236, in exchange_code_for_tokens
    "redirect_uri": self.redirect_uri,
  File "/projects/NS9252K/conda/synda/lib/python2.7/site-packages/globus_sdk/auth/client_types/base.py", line 400, in oauth2_token
    "/v2/oauth2/token", response_class=response_class, text_body=form_data
  File "/projects/NS9252K/conda/synda/lib/python2.7/site-packages/globus_sdk/base.py", line 287, in post
    retry_401=retry_401,
  File "/projects/NS9252K/conda/synda/lib/python2.7/site-packages/globus_sdk/base.py", line 552, in _request
    raise self.error_class(r)
globus_sdk.exc.AuthAPIError: (400, 'Error', u'invalid_grant')

However, I want to mention I have actually turned globus off in ~/.synda/conf/sdt.conf:

[module]
download = true
post_processing = false
globustransfer = false

Any suggestions what I can do next to fix this?

Thanks!

Yanchun

YanchunHe commented 4 years ago

An update:

Looks like if run this synda token -p globus renew, it works now..

I will close this issue.

stefsmeets commented 4 years ago

I get the same error with Synda 3.10. I don't have a globus account and globustransfer set to false, so the renew does not fix it. #149 solves this issue for me.