Skip to content
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

Using OAUTH2 to authenticate with ORCID #243

Closed
gmaze opened this issue Jan 6, 2023 · 9 comments
Closed

Using OAUTH2 to authenticate with ORCID #243

gmaze opened this issue Jan 6, 2023 · 9 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted question Further information is requested stale No activity over the last 90 days

Comments

@gmaze
Copy link
Member

gmaze commented Jan 6, 2023

ORCID is used by the Argo community to populate netcdf files with operators information.
Ifremer is implementing access to the Argo-CTD reference database for DMQC by erddap with an ORCID authentification.
We therefore need to be able to authenticate users in argopy.

The expected API could look like this:

import argopy
argopy.authenticate(service='orcid', user=USER, password=PASSWORD)

or simply:

import argopy
argopy.authenticate()

After authentification, argopy will be able to send erddap requests with the user orcid id.
but I'm not sure this will be enough on the server side to determine user access right to the proected dataset.

@gmaze gmaze added enhancement New feature or request question Further information is requested labels Jan 6, 2023
@gmaze gmaze added good first issue Good for newcomers help wanted labels Jan 18, 2023
@gmaze
Copy link
Member Author

gmaze commented Jan 18, 2023

If anyone has an idea on how to do this or help do it, that would be great !

@gmaze gmaze pinned this issue Jan 18, 2023
@leportella
Copy link

Hi :) I can try helping out on this one. Do we have this authenticate method today already? I couldn't find its definition in the repo. If not, how is the authetication done today? Thanks!

@gmaze
Copy link
Member Author

gmaze commented Feb 28, 2023

hi @leportella
thanks for raising your hand on this !
Basically, right now, argopy has no authentication process at all, that's why you didn't found any

We come to face the issue of having to fetch protected data from a web server (Erddap Ifremer) that is using ORCID to login users.

we thought that if argopy could be authenticating users with orcid as well, then we could fetch these protected data.
but I'm not sure this would work at all, may be you have an idea about this ?

but in any case, I think it would be useful over the long run for argopy to be able to authenticate orcid users, because the orcid ID is more and more used by the Argo Data Management Team to populate some parameters of the Argo dataset (especially to document quality control procedure). So this would be helpful at some point

@leportella
Copy link

I talked briefly with @ocefpaf and I think that this problem is 2 different problems from what I can tell:

  1. being able to authenticate in a session (be it in jupyter notebook or not) via something like argopy.authenticate
  2. being able to signup and authenticate using OAUTH2 (social networks)

Ideally, we need to understand how to do 1 before doing 2. Does that make sense?

@gmaze
Copy link
Member Author

gmaze commented Feb 28, 2023

this is on the verge of my knowledge !
I would have said that 2 can be used to make 1, and I see OAUTH2 to be more general that the specific social networks login

@gmaze
Copy link
Member Author

gmaze commented Mar 1, 2023

Following discussions at https://github.com/BobSimons/erddap/issues/92 ...

I can share here a peace of code I had working this morning that allows to request the erddap and get access to protected data, considering a initial procedure we will need to do differently:

  1. Go to the erddap webpage and login with orcid
  2. Open the devtools and get the value of the cookie named JSESSIONID
  3. Now you can send a request to the erddap using this cookie:
import aiohttp
import pandas as pd

url = 'https://erddap-val.ifremer.fr/erddap/info/index.json'
cookies = {'JSESSIONID': <COOKIEVALUE>}
async with aiohttp.ClientSession(cookies=cookies) as session:
    async with session.get(url) as resp:
        data = await resp.json()
df = pd.DataFrame(data['table']['rows'], columns=data['table']['columnNames'])
df = df[['Accessible', 'Dataset ID', 'Title']]
df
Accessible Dataset ID Title
public allDatasets * The List of All Active Datasets in this ERDD...
yes Argo-ref-ctd CTD Reference Measurements
public Argo-ref-ctd-public CTD Reference Measurements

So I guess, we are now left with the difficulty of getting this cooky automatically

@gmaze gmaze unpinned this issue Mar 27, 2023
@github-actions
Copy link

This issue was marked as staled automatically because it has not seen any activity in 90 days

@github-actions github-actions bot added the stale No activity over the last 90 days label May 30, 2023
@gmaze
Copy link
Member Author

gmaze commented Sep 29, 2023

Closing this issue because such authentication is no longer required

@gmaze gmaze closed this as completed Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted question Further information is requested stale No activity over the last 90 days
Projects
None yet
Development

No branches or pull requests

2 participants