anvilproject / client-apis

Clients for Python, R, javascript that interact with [terra, gen3, galaxy, others]
Apache License 2.0
9 stars 5 forks source link

Adds gen3 token handling #21

Closed bwalsh closed 4 years ago

bwalsh commented 4 years ago

The PR contains one new feature:

The class intercepts calls to the gen3 endpoint and ensures that:

We created an issue to track testing progress #22

image

bwalsh commented 4 years ago

Made great progress during week of 7/13. Was able to pick up and test this code.

However, somethings seems to have changed. Last week when I linked terra to anvil, under “IDENTITY & EXTERNAL SERVERS”, login to NHGRI AnVIL Data Commons Framework Services I was able to login with my google Id.

When I did that, everything worked as expected. Now, when I re-link terra to anvil, I’m presented with a NIH login. When I use that Id, the tests no longer work

image

However, checking the swagger api, where I can still authenticate using my google id, the call works.

image

bwalsh commented 4 years ago

image

E               anvil.gen3_auth.AnVILAuthError: Failed to authenticate to https://broad-bond-dev.appspot.com/api/link/v1/anvil/accesstoken
E               MUST respond with 200 https://broad-bond-dev.appspot.com/api/link/v1/anvil/accesstoken {"error":{"code":404,"errors":[{"domain":"global","message":"Could not find refresh token for user_id: 110793006573203727769 provider_name: anvil\nConsider relinking your account to Bond.","reason":"notFound"}],"message":"Could not find refresh token for user_id: 110793006573203727769 provider_name: anvil\nConsider relinking your account to Bond."}}

anvil/gen3_auth.py:143: AnVILAuthError
----------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------
gen3_auth.py                63 DEBUG    __call__, https://gen3.theanvil.io/api/v0/submission/graphql adding Authorization header
gen3_auth.py               114 DEBUG    get gcloud_access_token ['gcloud', 'auth', 'print-access-token', 'brian@bwalsh.com']
gen3_auth.py               119 DEBUG    gcloud_access_token ya29.a0AfHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXnuA
connectionpool.py          941 DEBUG    Starting new HTTPS connection (1): broad-bond-dev.appspot.com:443
connectionpool.py          442 DEBUG    https://broad-bond-dev.appspot.com:443 "GET /api/link/v1/anvil/accesstoken HTTP/1.1" 404 None
================================================================================ 1 failed in 2.27 seconds ================================================================================
bwalsh commented 4 years ago

pyAnVIL

https://pypi.org/project/pyAnVIL/0.0.1rc1/

Read the docs

https://pyanvil.readthedocs.io/en/pyanvil-auth/

Terra

image