astroquery icon indicating copy to clipboard operation
astroquery copied to clipboard

Gaia authentication broken?

Open gregreen opened this issue 4 months ago • 1 comments

I'm persistently running into the issue that Gaia.login() appears to have no effect. The API still thinks I'm not logged in afterwards, and returns an error whenever I try to take an action that requires one to be authenticated. Below is a minimal example:

>> from astroquery.gaia import Gaia

Gaia.login()
INFO: Login to gaia TAP server [astroquery.gaia.core]
User: my_username
Password: 
OK
INFO: Login to gaia data server [astroquery.gaia.core]
OK

>> Gaia.load_user('my_username')
403 Error 403:
User 'anonymous' is not authorized.
---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
<ipython-input-3-b080e926191a> in <module>
----> 1 Gaia.load_user('my_username')

~/.local/lib/python3.10/site-packages/astroquery/gaia/core.py in load_user(self, user_id, verbose)
    748         """
    749 
--> 750         return self.is_valid_user(user_id=user_id,
    751                                   verbose=verbose)
    752 

~/.local/lib/python3.10/site-packages/astroquery/utils/tap/core.py in is_valid_user(self, user_id, verbose)
   1228             print(response.status, response.reason)
   1229             print(response.getheaders())
-> 1230         connHandler.check_launch_response_status(response,
   1231                                                  verbose,
   1232                                                  200)

~/.local/lib/python3.10/site-packages/astroquery/utils/tap/conn/tapconn.py in check_launch_response_status(self, response, debug, expected_response_status, raise_exception)
    681             errMsg = taputils.get_http_response_error(response)
    682             print(response.status, errMsg)
--> 683             raise requests.exceptions.HTTPError(errMsg)
    684         else:
    685             return isError

HTTPError: Error 403:
User 'anonymous' is not authorized.

Somehow, the login is not "sticky." Is this a problem with astroquery, with the Gaia Archive, or with something else?

gregreen avatar Dec 14 '25 06:12 gregreen

Hi @gregreen,

I cannot reproduce the issue:

>>> import astroquery
>>> astroquery.__version__
'0.4.12.dev10370'
>>> from astroquery.gaia import Gaia
>>> Gaia.login()
INFO: Login to gaia TAP server [astroquery.gaia.core]
User: jferna
Password: 
INFO: OK [astroquery.utils.tap.core]
INFO: Login to gaia data server [astroquery.gaia.core]
INFO: OK [astroquery.utils.tap.core]
>>> Gaia.load_user('my_username')
False
>>> Gaia.load_user('jferna')
True
>>> Gaia.load_user('fake')
False

cosmoJFH avatar Dec 14 '25 11:12 cosmoJFH

I checked my astroquery version:

>>> astroquery.__version__
'0.4.6'

I upgraded to 0.4.11, and suddenly the above error disappears. So it appears that this was a problem with earlier versions of astroquery.

gregreen avatar Dec 15 '25 10:12 gregreen

Great new!

cosmoJFH avatar Dec 15 '25 10:12 cosmoJFH